MATLAB: How to solve nonlinear Trigonometry equations in matlab

m-filetrigonometry

Dear Friend I have a 5 nonlinear trigonometry equations with 5 parameters as following:
x*sin(z)-y*sin(k)=-2.061 ,
y*cos(k)-x*cos(z)=5.181 ,
x*cos(0.4904-z)+0.1*y*cos(0.4904+z)=0 ,
-1.032*cos(u)-0.1*y*sin(k)-0.2*x*sin(z)=-0.8821 ,
-1.032*sin(u)+0.1*y*cos(k)+0.2*x*cos(z)=-0.471 ,
How to calculate x,y,z,k,u? Best Regards

Best Answer

One possibility:
% MAPPING: b(1) = x, b(2) = y, b(3) = z, b(4) = k, b(5) = u
f = @(b) [b(1)*sin(b(3))-b(2)*sin(b(4))+2.061
b(2)*cos(b(4))-b(1)*cos(b(3))-5.181
b(1)*cos(0.4904-b(3))+0.1*b(2)*cos(0.4904+b(3))
-1.032*cos(b(5))-0.1*b(2)*sin(b(4))-0.2*b(1)*sin(b(3))+0.8821
-1.032*sin(b(5))+0.1*b(2)*cos(b(4))+0.2*b(1)*cos(b(3))+0.471];
B0 = rand(5,1)*2*pi;
[B,fv,xf,ops] = fsolve(f, B0);
ps = ['x'; 'y'; 'z'; 'k'; 'u'];
fprintf(1, '\n\tParameters:\n')
for k1 = 1:length(B)
fprintf(1, '\t\t%s = % .4f\n', ps(k1,:), B(k1))
end
that with one set of initial parameter estimates produces:
Parameters:
x = 0.9478
y = 5.8864
z = 1.6950
k = 0.5351
u = 1.1792
Related Question