Clear Filters
Clear Filters

trend line calculation and display

270 views (last 30 days)
Hi, how can I obtain and display a trend line from some points? I need the equation of the trend line. Thanks

Accepted Answer

Harry MacDowel
Harry MacDowel on 17 Oct 2011
First, plot the data like usual.
Then go to Tools -> Basic Fitting
Choose one of the fittings you like, then check Show Equation
Remember to click the Right Arrow key at the bottom right to view the values of the coefficients for the fit.

More Answers (2)

Sarah Weihmann
Sarah Weihmann on 14 Mar 2017
Hi Aravind S,
try the fit command for trendline calculation: http://de.mathworks.com/help/curvefit/fit.html Display the equation y=m*x+n as >> m=3; >> n=4; >> legend(sprintf('y=%f*x+%f',m,n));
Cheers, S

aravind S
aravind S on 9 Feb 2017
Is there command available?
  1 Comment
Pablo López
Pablo López on 27 Jun 2018
Edited: Pablo López on 27 Jun 2018
Sure! Take a look of polyfit for polynomial curve fitting.
Hope that helps!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!