fit an equation to data
Afficher commentaires plus anciens
Hi, I would like to find the six coefficients a,b,c,d, e and f of the equation z=a+b*x+c*y+d*x^2+e*x*y+f*y^2 to fit data contained in the matrix A=3x6 (with first row : z values, second row: x values and third row : y values)
Thank you very much
Réponses (1)
Star Strider
le 27 Juil 2015
Modifié(e) : Star Strider
le 27 Juil 2015
The easiest way:
z = A(1,:);
x = A(2,:);
y = A(3,:);
B = [ones(size(z(:))) x(:) y(:) x(:).^2 x(:).*y(:) y(:).^2]\z(:);
a = B(1)
b = B(2)
c = B(3)
d = B(4)
e = B(5)
f = B(6)
Catégories
En savoir plus sur 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!