Plot trend line based on data imported from excel

2 views (last 30 days)
Hi, I have used matlab for some time now, for importing data from excel and plotting it in matlab because the graphs look much better. This is the first time I have to do a trend line of the data. What is the way to do it because in insert there is no trend line option. In excel this is much simpler.
Do you have any idea how to do it?
I want to find trend line for the orange line separate from the blue line as well as a combined trend from both data sets.
I have attached a photo you can see the data there.
Best Regards,
Tsvetan

Answers (2)

Star Strider
Star Strider on 10 Jun 2017
No image and no data.
If you just want to plot a linear least-squares fit to your data, see if the lsline (link) function will do what you want.
The polyfit and polyval functions can create polynomial fits to your data, and will return parameters for the fit.

Tsvetan Donov
Tsvetan Donov on 10 Jun 2017
I am sorry, it didnt upload for some reason.

Community Treasure Hunt

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

Start Hunting!