【再补充】把参数早列出,早解决了,我假设了参数的值,你自己再改参数吧.程序通了.
function hhh
clc;clear
b = fsolve(@myfun,[2 3 4],optimset('Display','iter'))
function F = myfun(b)
l=1,a=1,R=1,r=1,l1c=1,l2c=1,l3c=1,z1=1,z2=2,z3=3
b1=b(1);b2=b(2);b3=b(3);
x1=-l*cos(a)*cos(b1)
y1=R-l1c-l*cos(a)*sin(b1)
x2=(0.5*l*cos(a)*cos(b2)+(l2c+l*cos(a)*sin(b2)-R)*3^0.5/2)
y2=(-3^0.5*l*cos(a)*cos(b2)/2+0.5*(l2c+l*cos(a)*sin(b2)-R))
x3=(0.5*l*cos(a)*cos(b3)-3^0.5*(l3c+l*cos(a)*sin(b3)-R)/2)
y3=(3^0.5*l*cos(a)*cos(b3)/2+0.5*(l3c+l*cos(a)*sin(b3)-R))
f1=(x1-x2)^2+(y1-y2)^2+(z1-z2)^2-3*r^2
f2=(x1-x3)^2+(y1-y3)^2+(z1-z3)^2-3*r^2
f3=(x1-x2)^2+(y1-y2)^2+(z1-z2)^2-(x3-x2)^2-(y3-y2)^2-(z3-z2)^2
F=[f1;f2;f3];
结果:
21 61 1.69271 3.8147e-006 5.79e-007 3.81e-006
Optimizer appears to be converging to a minimum that is not a root:
Sum of squares of the function values is > sqrt(options.TolFun).
Try again with a new starting point.
b =
1.9528 3.0000 4.0472
【补充】
未知数是:b1 b2 b3 x1 x2 x3 y1 y2 y3 z1 z2 z3,12个,方程组数量9个,除非你再告诉z1,z2,z3的值.
【】
我试了,用solve解不出来,给出l,a,R,r,l1c,l2c,l3c的值,再试试.
实在不行,就用fsolve试试.