Linear Fitting starting from a value
Afficher commentaires plus anciens
Hi everyone!
I need to fit these data [100 90 80 70 50 45 40 43 42 40 35] whom are distanced by 10 seconds.
The problem is that I would fit these data starting from the first value (100) in order to understand the slope of the line.

Is it possible?
Thanks!
Réponse acceptée
Plus de réponses (1)
Hiro Yoshino
le 10 Oct 2022
Modifié(e) : Hiro Yoshino
le 10 Oct 2022
refline is the easiest way to achieve that.
y = [100 90 80 70 50 45 40 43 42 40 35];
x = 0:10:10*(length(y)-1);
plot(x,y,'o');
refline
if you want to know the coefficients:
p = polyfit(x,y,1)
polyfit for reference.
1 commentaire
Nicola De Noni
le 10 Oct 2022
Catégories
En savoir plus sur Get Started with Curve Fitting Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
