polyfit with multiple dependent variables
Afficher commentaires plus anciens
I think
can handle multiple dependent variables. But when I tried
Fit = polyfit([x1 x2], x3, 1);
I got an error message
Error using polyfit (line 44)
The first two inputs must have the same number of elements.
Although I checked x1, x2, x3 has the same length. What can one do?
Réponse acceptée
Plus de réponses (1)
Remy Lassalle-Balier
le 17 Déc 2020
I think polyfit does not suport multiple dependent variables. The documentation is quite clear about the fact the first parameter should be a vector and not a matrix.
You can still run your fit manually:
X = [ ones( numel( x1 ) , 1 ) , x1(:) , x2(:) ];
fitParam = X\x3(:);
Fittedx3 = X * fitParam;
1 commentaire
alpedhuez
le 17 Déc 2020
Catégories
En savoir plus sur Logical 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!