用MATLAB或VB解四元二次方程组
最好用牛顿迭代法(x1-x)^2+(y1-y)^2+(z1-z)^2-(t1-t)^2=0(x2-x)^2+(y2-y)^2+(z2-z)^2-(t2-t)^2=0(x3...
最好用牛顿迭代法
(x1-x)^2+(y1-y)^2+(z1-z)^2-(t1-t)^2=0
(x2-x)^2+(y2-y)^2+(z2-z)^2-(t2-t)^2=0
(x3-x)^2+(y3-y)^2+(z3-z)^2-(t3-t)^2=0
(x4-x)^2+(y4-y)^2+(z4-z)^2-(t4-t)^2=0
求x、y、z、t 展开
(x1-x)^2+(y1-y)^2+(z1-z)^2-(t1-t)^2=0
(x2-x)^2+(y2-y)^2+(z2-z)^2-(t2-t)^2=0
(x3-x)^2+(y3-y)^2+(z3-z)^2-(t3-t)^2=0
(x4-x)^2+(y4-y)^2+(z4-z)^2-(t4-t)^2=0
求x、y、z、t 展开
3个回答
展开全部
用fsolve求解
建立myfunn.m文件,内容为
function F = myfunn(x,x1,y1,z1,t1,x2,y2,z2,t2,x3,y3,z3,t3,x4,y4,z4,t4)
F=[(x1-x(1))^2+(y1-x(2))^2+(z1-x(3))^2-(t1-x(4))^2
(x2-x(1))^2+(y2-x(2))^2+(z2-x(3))^2-(t2-x(4))^2
(x3-x(1))^2+(y3-x(2))^2+(z3-x(3))^2-(t3-x(4))^2
(x4-x(1))^2+(y4-x(2))^2+(z4-x(3))^2-(t4-x(4))^2];
命令行下输入:
x0 = [0; 0; 0; 0];
x1=1;y1=1;z1=1;t1=1; %设定参数值,根据需要修改
x2=2;y2=1;z2=2;t2=1;
x3=3;y3=1;z3=3;t3=1;
x4=4;y4=1;z4=4;t4=1;
x = fsolve(@(x)myfunn(x,x1,y1,z1,t1,x2,y2,z2,t2,x3,y3,z3,t3,x4,y4,z4,t4),x0)
建立myfunn.m文件,内容为
function F = myfunn(x,x1,y1,z1,t1,x2,y2,z2,t2,x3,y3,z3,t3,x4,y4,z4,t4)
F=[(x1-x(1))^2+(y1-x(2))^2+(z1-x(3))^2-(t1-x(4))^2
(x2-x(1))^2+(y2-x(2))^2+(z2-x(3))^2-(t2-x(4))^2
(x3-x(1))^2+(y3-x(2))^2+(z3-x(3))^2-(t3-x(4))^2
(x4-x(1))^2+(y4-x(2))^2+(z4-x(3))^2-(t4-x(4))^2];
命令行下输入:
x0 = [0; 0; 0; 0];
x1=1;y1=1;z1=1;t1=1; %设定参数值,根据需要修改
x2=2;y2=1;z2=2;t2=1;
x3=3;y3=1;z3=3;t3=1;
x4=4;y4=1;z4=4;t4=1;
x = fsolve(@(x)myfunn(x,x1,y1,z1,t1,x2,y2,z2,t2,x3,y3,z3,t3,x4,y4,z4,t4),x0)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询