How to draw mean value as shown in picture

1 Ansicht (letzte 30 Tage)
Hi,
I want to plot the mean value as shown in red line in the attached picture.
Any help or idea is highly appreciated.
Thanks

Akzeptierte Antwort

Image Analyst
Image Analyst am 19 Nov. 2021
Another option is sgolayfilt(). It's like movmean() but instead of fitting a line to the moving window you can fit a quadratic. That should help it follow the big peak better an not smooth it out so much. I'd use a frame (window) length that's large and an order of 2 or 3. Experiment around to get what you like.
plot(x, y, 'k-');
smoothY = sgolayfilt(y, 11, 2);
hold on;
plot(x, smoothY, 'r-', 'LineWidth', 3);
  1 Kommentar
Muhammadhn Muhammadh Khalid
Muhammadhn Muhammadh Khalid am 21 Nov. 2021
Thanks. Exactly what i was looking for. Was working for higher f and smaller k. sgolayfilt(y, k, f).

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Matt J
Matt J am 19 Nov. 2021

Kategorien

Mehr zu Fit Postprocessing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by