Effacer les filtres
Effacer les filtres

trailing string input must be double or native error

8 vues (au cours des 30 derniers jours)
shiksha
shiksha le 27 Fév 2014
Commenté : shiksha le 28 Fév 2014
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 commentaires
shiksha
shiksha le 28 Fév 2014
Modifié(e) : shiksha le 28 Fév 2014
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
shiksha
shiksha le 28 Fév 2014
i got the answer. i just hd to transpose one input.

Connectez-vous pour commenter.

Réponse acceptée

Mischa Kim
Mischa Kim le 27 Fév 2014
Modifié(e) : Mischa Kim le 27 Fév 2014
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 commentaires
shiksha
shiksha le 28 Fév 2014
do u know how to apply low pass filter to smoothen the curve?
shiksha
shiksha le 28 Fév 2014
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

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by