필터 지우기
필터 지우기

How do I integrate two columns of discrete data?i need do operations between the data

조회 수: 3 (최근 30일)
HERE are two columns discrete data,the frequency is 20Hz,i need integrate them, the equation is
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

채택된 답변

VBBV
VBBV 2021년 2월 3일
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
VBBV
VBBV 2021년 2월 4일
See earlier it was (x/y*(x+y)/20
Check this (x/y)*(x+y)/20;
xiaoqian chang
xiaoqian chang 2021년 2월 5일
I found the error that x<y was not always true,I changed some code about that,so I think I get the right answer ,thanks a lot !!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Bartlett에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by