0
实际上,我必须计算大概8或9个非线性方程中的3个变量的值(可能更精确)。在matlab中求解确定的非线性方程
我正在使用lsqnonlin和fsolve。 使用lsqnonlin,它说解算器过早停止(主要是由于迭代的值,funEvals和容差),并且输出远离精确解。我试过了,但我不知道应该在什么基础上设置这些参数。
使用fsolve,它说没有找到解决方案。
我也使用LMFnlsq和LMFsolve,但它给输出远没有接近确切的解决方案吗?我也试图改变其他参数,但是我无法将这些解决方案带入我期望的值。
有没有其他办法来解决这些超定非线性方程?
我的代码至今:
x0 = [20 40 275];
eqn = @(x)[((((x(1)-Sat(1,1))^2+(x(2)-Sat(1,2))^2+(x(3)-Sat(1,3))^2))-dis(1)^2);
((((x(1)-Sat(2,1))^2+(x(2)-Sat(2,2))^2+(x(3)-Sat(2,3))^2))-dis(2)^2);
((((x(1)-Sat(3,1))^2+(x(2)-Sat(3,2))^2+(x(3)-Sat(3,3))^2))- dis(3)^2);
((((x(1)-Sat(4,1))^2+(x(2)-Sat(4,2))^2+(x(3)-Sat(4,3))^2))- dis(4))^2;
((((x(1)-Sat(5,1))^2+(x(2)-Sat(5,2))^2+(x(3)-Sat(5,3))^2))- dis(5))^2;
((((x(1)-Sat(6,1))^2+(x(2)-Sat(6,2))^2+(x(3)-Sat(6,3))^2))- dis(6))^2;
((((x(1)-Sat(7,1))^2+(x(2)-Sat(7,2))^2+(x(3)-Sat(7,3))^2))- dis(7))^2;
((((x(1)-Sat(8,1))^2+(x(2)-Sat(8,2))^2+(x(3)-Sat(8,3))^2))- dis(8))^2;
((((x(1)-Sat(9,1))^2+(x(2)-Sat(9,2))^2+(x(3)-Sat(9,3))^2))- dis(9))^2;
((((x(1)-Sat(10,1))^2+(x(2)-Sat(10,2))^2+(x(3)-Sat(10,3))^2))- dis(10))^2];
lb = [0 0 0];
ub = [100 100 10000];
options = optimoptions('lsqnonlin','MaxFunEvals',3000,'MaxIter',700,'TolFun',1e-18);%,'TolX',1);
x= lsqnonlin(eqn,x0,lb,ub,options)
**Error:**
**Solver stopped prematurely.**
lsqnonlin stopped because it exceeded the iteration limit,
options.MaxIter = 700 (the selected value).
x = 20.349 46.633 9561.5
盼望一些建议!
在此先感谢!
向我们展示您尝试过的。如果我们还没有看到你迄今为止尝试过的东西,那么就不可能提出建议。 – rayryeng
您*可能会在http://math.stackexchange.com/上得到更好的回复。 – RoadieRich
我已经添加了一些我已经完成的代码。希望这可以奏效@rayryeng – Prajan