Error using plot: Value not a numeric scalar

I am using this running average function to smooth out dome noisey data.
function y = RunningAvg(x,w)
wts = ones(1, w) / w
new = conv(x, wts, 'same');
end
However, when I plot the filtered signal, I get this error massage
Error using plot
Value not a numeric scalar

7 comentarios

David Hill
David Hill el 31 de En. de 2020
Please provide example inputs (x,w) to your function. There is no y that is returned.
Walter Roberson
Walter Roberson el 31 de En. de 2020
Editada: Walter Roberson el 31 de En. de 2020
we need to see the plot call
Romio
Romio el 31 de En. de 2020
x is a noisy dataset. The plot of x is the following
fig.jpg
Walter Roberson
Walter Roberson el 31 de En. de 2020
It appears that w would be expected to be a positive integer. But we still need to see the call to plot()
Romio
Romio el 31 de En. de 2020
Sorry I don't understand "call to plot()"
Do you mean this "plot(t,x_smoothed,'linewidth','2')"
That is all the code after the using the function to filter the data
Romio
Romio el 31 de En. de 2020
and it is true that there are some noninterger data in the x_smooth. Is there anyway to override that?
Yes, it was that line
plot(t,x_smoothed,'linewidth','2')
that we were looking for.

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 31 de En. de 2020
plot(t,x_smoothed,'linewidth','2')
Line widths must be numeric.
plot(t,x_smoothed,'linewidth',2)

2 comentarios

Romio
Romio el 31 de En. de 2020
I am such an idiot! Thank you!!!!!

Iniciar sesión para comentar.

Categorías

Más información sobre Electrical Block Libraries en Centro de ayuda y File Exchange.

Productos

Versión

R2018b

Etiquetas

Preguntada:

el 30 de En. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by