四元非线性matlab,求解一个四元非线性方程组的问题,使用lsqnonlin算不出结果,希望各位能帮忙看看,请不吝指教!如果可以的话,希望能贴出代码方便交流!...

function G = fun(x)

alpha=0.125*pi/180;x1=0;z1=5;x2=0;z2=25;L1=5;L2=5;f=30;h0=20;n2=1.49386;

G1 = tan(alpha) - x(1)/x(2);

G2 = n2*sin(atan((x1 - x(1))/(z1 - x(2))) - atan((x(2) - x(4))/(x(1) - x(3)))) - sin(pi/2 - alpha + atan((x1 - x(1))/(z1 - x(2)))) ;

G3 = n2*sin(atan((x2 - x(3))/(z2 - x(4))) - atan((x(2) - x(4))/(x(1) - x(3)))) - sin(pi/2 + atan((x2 - x(3))/(z2 - x(4))));

G4 = L1 + L2 - f + h0 - h0*n2 + n2*((x(1) - x(3))^2 + (x(2) - x(4))^2)^(1/2);

G = G1.^2 + G2.^2 + G3.^2 + G4.^2;

----------------------------------------------------------------------------------------------------------------------------------------------

X0 = [0.01,5.01,0.01,25.01];

options=optimset('Algorithm', 'levenberg-marquardt','Display','iter', 'MaxFunEvals',20000,'MaxIter',1000);

T = lsqnonlin(@fun,X0,[],[],options)

----------------------------------------------------------------------------------------------------------------------------------------------

First-Order                    Norm of

Iteration  Func-count    Residual       optimality      Lambda           step

0           5       0.0589634        9.75e+07         0.01

Local minimum possible.

lsqnonlin stopped because the relative size of the current step is less than

the default value of the step size tolerance.

T =

0.010000000000000   5.010000000000000   0.010000000000000  25.010000000000002

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值