How do I integrate two columns of discrete data?i need do operations between the data
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
xiaoqian chang
am 3 Feb. 2021
Kommentiert: xiaoqian chang
am 5 Feb. 2021
HERE are two columns discrete data,the frequency is 20Hz,i need integrate them, the equation is
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/508047/image.png)
i try to write some codes,but i don't know it is right or not. Can someone help me check it??
but the discrete data should use the 'trap' function, how can i modify the code?
[str,pathname]=uigetfile('*.csv') ;
[xy]=csvread(str);
n=length(xy);% data length
x=xy(:,1);y=xy(:,2);
for i=1:n % step=1
% F=x/y*(x+y);
p=sum(x(i)/y(i)*(x(i)+y(i)))/20;% frenquency=20
end
0 Kommentare
Akzeptierte Antwort
VBBV
am 3 Feb. 2021
for i=1:n % step=1
% F=x/y*(x+y);
p(i)=(x(i)/y(i)*(x(i)+y(i)))/20;% frenquency=20
end
P = sum(p); % use sum outside of loop
Use sum outside of loop
7 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Bartlett finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!