Extending a line of best fit with delta

조회 수: 3 (최근 30일)
azhao
azhao 2020년 10월 17일
댓글: Adam Danz 2020년 10월 18일
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