how to get the equation of lsline
Show older comments
hi. I have two set of data and I want to get the linear regression. after plotting the data, im using lsline to obtain the regression line but how can I get the equation too ? thanks !
Accepted Answer
More Answers (1)
Kylie Hansen
on 16 Feb 2017
Thought I'd post an alternative answer from this github repository: https://github.com/kykyelric/Marking-Points-Above-Line-of-Best-Fit/blob/master/lsline%20equation
The below code prints a 1x2 matrix where the first value is the slope and the second is the y-int.
h = lsline;
p2 = polyfit(get(h,'xdata'),get(h,'ydata'),1)
Categories
Find more on Linear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!