大侠们帮忙看看这个方程怎么用matlab解
小妹才接触matlab,可能问的比较白痴,呵呵syms a b c d;
=solve('-a/b=(b-d)/(a-c)','a^2+b^2=25',...
'-c/d=(b-d)/(a-c)','c^2+d^2=0.0001');
求 abcd,可这么编运行不出来,能给出实数的数值解就行
多谢 大家帮帮忙吧,实在不会啊 Explicit solution could not be found
可能没有显式解
你确定这个方程组有实数解吗?
高手继续
[ 本帖最后由 toes 于 2006-10-11 12:20 编辑 ] solve('-a/b=(b-d)/(a-c)','a^2+b^2=25',...
'-c/d=(b-d)/(a-c)','c^2+d^2=1')
Warning: Explicit solution could not be found
没有解析解,或者没有实数解!
solve()是用来求方程的解析解或数值解的,这里我感觉应该用fsolve()来求非线性方程组的解! 这是一个大圆与非常小的圆的公切线,作图能做出来,就应该有解吧
高手们帮看看吧 午夜流星很早以前写的,可以参考:
function tangency(x1,y1,r1,x2,y2,r2)
% x1,y1,r1,x2,y2,r2为两圆的圆心坐标与半径
R=sqrt((y2-y1)^2+(x2-x1)^2); %圆心距
%外切线
r0=R*r2/(r1-r2);%切线与两圆心连线的交点与第个圆心的矢量距离
syms x y
=solve((y-y2)^2+(x-x2)^2-r0^2,y*(x2-x1)-x*(y2-y1)-x2*y1+x1*y2);% 求解焦点
a=asin(r2/r0); %切线与两圆心连线的夹角
b=atan((y2-y1)/(x2-x1));%两圆心连线与x轴的夹角
%画圆
t=0:0.01:2*pi;
x11=x1+r1*cos(t);
y11=y1+r1*sin(t);
x22=x2+r2*cos(t);
y22=y2+r2*sin(t);
plot(x11,y11 ,x22,y22)
hold on
% 画切线
if r1>r2
xe=x(2);
ye=y(2);
xx=double();
else
xe=x(1);
ye=y(1);
xx=double();
end
yy1=double(tan(a-b)*(xe-xx)+ye);%两条切线
yy2=double(tan(-a-b)*(xe-xx)+ye);
plot(xx,yy1,xx,yy2)
hold on
axis equal
%内切线,意义同上
ifR>=r1+r2
r0=R*r2/(r1+r2);
syms x y
=solve((y-y2)^2+(x-x2)^2-r0^2,y*(x2-x1)-x*(y2-y1)-x2*y1+x1*y2);
a=asin(r2/r0);
b=atan((y2-y1)/(x2-x1));
xe=x(1);
ye=y(1);
xx=double();
yy1=double(tan(a-b)*(xe-xx)+ye);
yy2=double(tan(-a-b)*(xe-xx)+ye);
plot(xx,yy1,xx,yy2)
hold
end
axis equal
axis([-2*abs(min(x1-r1,x2-r2)),2*abs(max(x1+r1,x2+r2)),-2*abs(min(y1-r1,y2-r2)),2*abs(max(y1+r1,y2+r2))])
原帖由 bainhome 于 2006-10-11 16:46 发表
午夜流星很早以前写的,可以参考:
function tangency(x1,y1,r1,x2,y2,r2)
% x1,y1,r1,x2,y2,r2为两圆的圆心坐标与半径
R=sqrt((y2-y1)^2+(x2-x1)^2); %圆心距
%外切线
r0=R*r2/(r1-r2);%切线 ...
应该是好东西,呵呵。
怀疑楼主的方程给错了。
我试了一下,假设小圆半径0.01,圆心在原点,大圆半径5,圆心在(10,0)。求最上面的外切线。可以得到8个解,其中4个为实数解。结果对不对没有检验,反正有解,呵呵。
syms a b c d;
=solve('(a-10)/b=(b-d)/(a-c)','(a-10)^2+b^2=25',...
'-c/d=(b-d)/(a-c)','c^2+d^2=0.0001')
a =
11.827239304683761073493483732969
3.1727606953162389265065162670311
3.1727606953162389265065162670311
11.827239304683761073493483732969
11.833012808658658927228143150412
3.1669871913413410727718568495883
3.1669871913413410727718568495883
11.833012808658658927228143150412
b =
-4.6541590565234022057016554180170
-4.6487844135234756407054525114233*i
4.6487844135234756407054525114233*i
4.6541590565234022057016554180170
4.6518882234307064910913711426241
4.6572592845248904647269372164182*i
-4.6572592845248904647269372164182*i
-4.6518882234307064910913711426241
c =
-.36544786093675221469869674659377e-2
.13654478609367522146986967465938e-1
.13654478609367522146986967465938e-1
-.36544786093675221469869674659377e-2
.36660256173173178544562863008234e-2
-.13666025617317317854456286300823e-1
-.13666025617317317854456286300823e-1
.36660256173173178544562863008234e-2
d =
-.93083181130468044114033108360341e-2
-.92975688270469512814109050228465e-2*i
.92975688270469512814109050228465e-2*i
.93083181130468044114033108360341e-2
-.93037764468614129821827422852482e-2
-.93145185690497809294538744328363e-2*i
.93145185690497809294538744328363e-2*i
.93037764468614129821827422852482e-2 从上面的帖子里找,可以找到至少一组实数解,例如=仔细看看,应该还有 楼上的几位高手们,多谢了
还想问问,能不能只保留对应的实数解
先谢过
页:
[1]