How to smooth this plot?

7 visualizaciones (últimos 30 días)
Dimitrios
Dimitrios el 7 de Dic. de 2014
Comentada: Image Analyst el 7 de Dic. de 2014
I am ploting a signal in frequency domain and i am trying to smooth the results in order to be clear for the viewer.The following plot shows my results:
In red line the desired results.I am trying to use the smooth function but cant consider which method and span is the appropriate for these results.Any recomendations?
Edit:
I used sgolayfilt() with the following results,where it can e seen that it cannot catch the high values:
Is there a way to 'say to the function that i want to smooth my results in respect to my high values?I attach in a file the signal.

Respuesta aceptada

Image Analyst
Image Analyst el 7 de Dic. de 2014
If you have the Signal Processing Toolbox, try sgolayfilt() to do a moving polynomial window. If you have the Curve Fitting Toolbox, try lowess(), loess(), smooth(), or rloess(). Attach your data if you want an example with your data. I've attached an example for the Savitzky-Golay filter, which will produce this image.
  2 comentarios
Dimitrios
Dimitrios el 7 de Dic. de 2014
Thanks for your answer.I edited my question in case you want to check.
Image Analyst
Image Analyst el 7 de Dic. de 2014
The high values get smoothed away because it's assumed they are outliers. You can add them back in if you want by replacing any elements where the original minus the smoothed is more than some amount, by the original. Do you want to do that? This will put certain spikes back in.
% Find the difference signal.
diffSignal = signal - smoothSignal;
% Find where the difference is more than 2.
bigSpikes = diffSignal > 2;
% Replace with original
smoothSignal(bigSpikes) = signal(bigSpikes);
You can use abs(diffSignal > 2) if you want to put back in big negative going spikes also.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by