MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   解四元二次方程组 (https://www.labfans.com/bbs/showthread.php?t=7026)

fuhao_987 2009-03-23 16:44

解四元二次方程组
 
大家好,小妹有个问题请教你们。
四个方程组:
((t0-t1)*v)^2=z^2+y^2+(x-a)^2;
((t0-t2)*v)^2=z^2+y^2+x^2;
((t0-t3)*v)^2=z^2+(y-a/2)^2+(x-a/2)^2;
((t0-t4)*v)^2=(z-a/3)^2+y^2+(x-a/2)^2;

t0,x,y,z未知
t1,t2,t3,t4,a已知

怎样用matlab求解,如果t1,t2,t3,t4可以作为参数传递的话,又怎么做啊。

laosam280 2009-03-25 16:59

回复: 解四元二次方程组
 
首先,编写一个不动点迭代法的求解程序。不动点解法比较简单,同样还有牛顿法,下山法。。。不一一类举了。
function [r,n]=stablepoint(x0,eps)
% 初始迭代点x0
% 迭代精度 eps
% 解 r
% 迭代步数 n
if nargin==1
eps=1.0e-4;
end
r=fun(x0);
n=1;
tol=1;
while tol>eps
x0=r;
r=fun(x0);
tol=norm(r-x0);
n=n+1;
if(n>100000)
disp('sum of steps is too much !');
return;
end
end

其中fun函数就是你需要求解的方程组。

laosam280 2009-03-25 17:01

回复: 解四元二次方程组
 
用 function f=fun(x)
f(1)=...
f(2)=...
f(3)=...
f(4)=...

最后取初值为[0,0],迭代即可。


所有时间均为北京时间。现在的时间是 18:15

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.