trailing string input must be double or native error

hi, i have a text file that i have attached. i am plotting the 4th column.but the curve has some disturbances. to smoothen the curve i used the average:
for i=2:250 a(i)=sum(y(i-1),y,y(i+1)) z(i)=a(i)/3 end
i am getting the following error: error using sum trailing string input must be "double" or "native". what is the errror?
thanks in advance.
regards, shiksha

댓글 수: 2

shiksha
shiksha 2014년 2월 28일
편집: shiksha 2014년 2월 28일
for i = 2:249 z(i) = sum(y(i-1:i+1))/3; end
how to display the answer z that i have obtained? i am just able to plot it.. and i want to plot the differential of z with time(5th column in text file), so i used: plot(diff(z)./diff(m(1:250,5)),'x') but i am getting an error : error using ==>rdivide matrix dimensions must agree..
the size of z is 1 249 the size of m(:,5) is 250 1 can u just tell me what is the error? please help..
regards, shiksha
i got the answer. i just hd to transpose one input.

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

 채택된 답변

Mischa Kim
Mischa Kim 2014년 2월 27일
편집: Mischa Kim 2014년 2월 27일
Shiksha, I assume your text file has 250 rows? If that's the case in the statement
a(i)=sum(y(i-1),y,y(i+1))
you are accessing for i=250 the 251 st element, y(i+1), which results in the error. Also, the middle term does not access a particular element. Finally, unless you need matrix a, you could simply do
for i = 2:249
z(i) = sum(y(i-1:i+1))/3;
end

댓글 수: 3

thanks. its working now.
do u know how to apply low pass filter to smoothen the curve?
how to display the answer z that i have obtained? i am just able to plot it.. and i want to plot the differential of z with time(5th column in text file), so i used: plot(diff(z)./diff(m(1:250,5)),'x') but i am getting an error : error using ==>rdivide matrix dimensions must agree..
can u just tell me what is the error? please help..
regards, shiksha

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Fit Postprocessing에 대해 자세히 알아보기

태그

질문:

2014년 2월 27일

댓글:

2014년 2월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by