Extending a line of best fit with delta

3 visualizzazioni (ultimi 30 giorni)
azhao
azhao il 17 Ott 2020
Commentato: Adam Danz il 18 Ott 2020
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 Commento
Adam Danz
Adam Danz il 18 Ott 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().

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Interpolation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by