trailing string input must be double or native error

2 visualizaciones (últimos 30 días)
shiksha
shiksha el 27 de Feb. de 2014
Comentada: shiksha el 28 de Feb. de 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 comentarios
shiksha
shiksha el 28 de Feb. de 2014
Editada: shiksha el 28 de Feb. de 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 el 28 de Feb. de 2014
i got the answer. i just hd to transpose one input.

Iniciar sesión para comentar.

Respuesta aceptada

Mischa Kim
Mischa Kim el 27 de Feb. de 2014
Editada: Mischa Kim el 27 de Feb. de 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 comentarios
shiksha
shiksha el 28 de Feb. de 2014
do u know how to apply low pass filter to smoothen the curve?
shiksha
shiksha el 28 de Feb. de 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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Fit Postprocessing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by