Extending a line of best fit with delta
3 views (last 30 days)
Show older comments
I have a datapoint at x=20,40,60,80,100 and I used polyfit to perform a linear fit. Say my polyfit equation is y_fit. In addition, I'm using polyval to find the normr values of the linear fit. From polyval, there's also a delta matrix generated. I'm trying to extend the line of best fit from x = 0 to x = 150 for the plots y_fit-2*delta and y_fit+2*delta from x = 0 to x = 150. What would be the best way to do so
Thanks :)
1 Comment
Adam Danz
on 18 Oct 2020
If you use refline() the line will extend across the entire axes.
Otherwise, use the x values (0 and 150) as inputs to your linear function to get the y values. Then use the x and y values to plot a line using plot() or line().
Answers (0)
See Also
Categories
Find more on Interpolation 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!