$$
\left\{\begin{aligned}
&\cos (x_3) \sin (x_2)  \sin (x_1)-\sin (x_3)  \cos (x_1)=-0.9944 \\
&\sin (x_3)  \sin (x_2)  \sin (x 1)+\cos (x_3)  \cos (x_1)=-0.0870 \\
&\cos (x 2)  \sin (x_1)=-0.0606 \\
&\cos (x_3)  \sin (x_2)  \cos (x_1)+\sin (x_3)  \sin (x_1)=0.0349 \\
&\sin (x_3)  \sin (x_2)  \cos (x_1)-\cos (x_3)  \sin (x_1)=-0.8085 \\
&\cos (x_2)  \cos (x_1)=0.5875 \\
&\cos(x_3) \cos (x_2)=-0.1001 \\
&\sin (x_3)  \cos (x_2)=0.5821 \\
&-\sin (x_2)=0.8070
\end{aligned}\right.
$$

 

1. 编写M文件,定义函数

function F=y_fun(x)
x1=x(1);x2=x(2);x3=x(3);
F(1)=cos(x3)*sin(x2)*sin(x1)-sin(x3)*cos(x1)+0.9944;
F(2)=sin(x3)*sin(x2)*sin(x1)+cos(x3)*cos(x1)+0.0870;
F(3)=cos(x2)*sin(x1)+0.0606;
F(4)=cos(x3)*sin(x2)*cos(x1)+sin(x3)*sin(x1)-0.0349;
F(5)=sin(x3)*sin(x2)*cos(x1)-cos(x3)*sin(x1)+0.8085;
F(6)=cos(x2)*cos(x1)-0.5875;
F(7)=cos(x3)*cos(x2)+0.1001;
F(8)=sin(x3)*cos(x2)-0.5821;
F(9)=-sin(x2)-0.8070;

 

2. 编写程序

x0=[0.3 0.4 0.5]; 
 [x,resnorm]=lsqnonlin(@y_fun,x0)

posted on 2022-05-20 10:35  YSDCR  阅读(323)  评论(0编辑  收藏  举报