fitting error, how to fix it
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Wu Yuan
le 16 Juil 2014
Réponse apportée : Azzi Abdelmalek
le 16 Juil 2014
I am trying to run the following code, and get the error, please advice how to fix it, thank you.
x = (0:0.2:5)';
y = 2*exp(-0.2*x) + 0.1*randn(size(x));
f = fit(x,y,'exp1')
plot(f,x,y)
"Subscript indices must either be real positive integers or logicals."
0 commentaires
Réponse acceptée
Azzi Abdelmalek
le 16 Juil 2014
Probably, you have used fit as a variable in your code
Try this
clear fit
x = (0:0.2:5)';
y = 2*exp(-0.2*x) + 0.1*randn(size(x));
f = fit(x,y,'exp1')
plot(f,x,y)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Linear and Nonlinear Regression dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!