fit an equation to data
Mostrar comentarios más antiguos
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
Respuestas (1)
Star Strider
el 27 de Jul. de 2015
Editada: Star Strider
el 27 de Jul. de 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)
Categorías
Más información sobre Curve Fitting Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!