MATLAB: How to find the unknown parameters of a non-linear equation ?

i am new to matlab

I am having a equation z^2=x(1)*a+x(2)*b+x(3)*c+x(4)*a^2+x(5)*b^2+x(6)*c^2+x(7)*a*b+x(8)*a*c+x(9)*c*b
Value of a b c and z
a=[27 26.4 29.19 22.22 27.5 21.33 23.84 31.11 19.5 28.44 22.5 36.08]
b=[95 87 81 72 76 76 95 82 89 89 88 83 ]
c=[171.3 191.9 105.9 167.2 172.8 112.7 106.9 122.2 124.9 98.8 120.1 161.6 ]
z=[0.76 0.33 0.51 0.85 0.81 1.02 0.36 0.86 0.28 0.59 0.73 0.38 ]
can anyone explain the steps for finding x(1)………..x(9)

Best Answer

A = [a(:), b(:), c(:), a(:).^2, b(:).^2, c(:).^2, a(:).*b(:), a(:).*c(:), b(:).*c(:)];
B = z(:).^2;
x = A\B;
Your equation is linear in your x, so you can just construct the coefficient matrix and use the \ operator.
You will only get meaningful results if your a, b, c, and z are at least 9 elements long.