Extending a line of best fit with delta

3 次查看(过去 30 天)
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 个评论
Adam Danz
Adam Danz 2020-10-18
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().

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by