How to add trendline

7 views (last 30 days)
Buket Sahin
Buket Sahin on 7 Dec 2021
Answered: Star Strider on 7 Dec 2021
I have a graph like below.
How can I add a trendline line to it, like a trendline black stripe in the below figure?

Answers (2)

_ on 7 Dec 2021
Look into movmean.

Star Strider
Star Strider on 7 Dec 2021
There are any number of approaches, including lowpass filters of various descriptions.
Another one would be polyfit and polyval, perhaps with a degree 4 polynomial.

Community Treasure Hunt

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

Start Hunting!

Translated by