使用matlab中的solve函数求解符号方程组的问题我在matlab中输入如下:>> syms x y xp yp xi yi min;>> f1='(x-xp)^2+(y-yp)^2=min^2';>> f2='(x-xi)^2+(y-yi)^2=3*min^2';>> [x,y]=solve(f1,f2)求解的结果是x =xp+(-yp^2+min^2-y^2+2*y*y
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/05 21:48:15
使用matlab中的solve函数求解符号方程组的问题我在matlab中输入如下:>> syms x y xp yp xi yi min;>> f1='(x-xp)^2+(y-yp)^2=min^2';>> f2='(x-xi)^2+(y-yi)^2=3*min^2';>> [x,y]=solve(f1,f2)求解的结果是x =xp+(-yp^2+min^2-y^2+2*y*y
使用matlab中的solve函数求解符号方程组的问题
我在matlab中输入如下:
>> syms x y xp yp xi yi min;
>> f1='(x-xp)^2+(y-yp)^2=min^2';
>> f2='(x-xi)^2+(y-yi)^2=3*min^2';
>> [x,y]=solve(f1,f2)
求解的结果是x =
xp+(-yp^2+min^2-y^2+2*y*yp)^(1/2)
xp+(-yp^2+min^2-y^2+2*y*yp)^(1/2)
xp-(-yp^2+min^2-y^2+2*y*yp)^(1/2)
xp-(-yp^2+min^2-y^2+2*y*yp)^(1/2)
y=
xp+(-yp^2+min^2-y^2+2*y*yp)^(1/2)+(2*y*yi-yi^2+3*min^2-y^2)^(1/2)
xp+(-yp^2+min^2-y^2+2*y*yp)^(1/2)-(2*y*yi-yi^2+3*min^2-y^2)^(1/2)
xp-(-yp^2+min^2-y^2+2*y*yp)^(1/2)+(2*y*yi-yi^2+3*min^2-y^2)^(1/2)
xp-(-yp^2+min^2-y^2+2*y*yp)^(1/2)-(2*y*yi-yi^2+3*min^2-y^2)^(1/2)
x和y应该只有两组解,怎么出来四组了呢?更大问题是x,y的表达式中还含有x,y本身,请问各位这是怎么回事啊?
使用matlab中的solve函数求解符号方程组的问题我在matlab中输入如下:>> syms x y xp yp xi yi min;>> f1='(x-xp)^2+(y-yp)^2=min^2';>> f2='(x-xi)^2+(y-yi)^2=3*min^2';>> [x,y]=solve(f1,f2)求解的结果是x =xp+(-yp^2+min^2-y^2+2*y*y
不知你的什么版本,我是2011a就告诉我no explicit solution即无解析解.没有出现你这种情况.
这个方程组就是求两圆交点,顶多有两组解,你仔细看解出来的x第一个和x第二个是一模一样的.后两个也是一样的.我以前用低版本的matlab(7.0.1),似乎得到过你这样的解,但是现在用新版本的做就没有这样的问题.
no explicit solution的话,需要求数值解了(matlab说没解析解,不等于你就算不出来了,它经常会告诉你没解析解的,不要吃惊).其实你这里手算很好算的,何必让电脑去帮你做.matlab符号解方程的能力非常有限,只能够解很简单的有解析解的方程,它的优势在于数值运算,就是你给出除了x,y以外其他变量的数值然后让它解.
>> syms x y xp yp xi yi min
f1=(x-xp)^2+(y-yp)^2-min^2;
f2=(x-xi)^2+(y-yi)^2-3*min^2;
D=solve(f1,f2,x,y)
D =
x: [2x1 sym]
y: [2x1 sym]
>> D.x
ans =
...
全部展开
>> syms x y xp yp xi yi min
f1=(x-xp)^2+(y-yp)^2-min^2;
f2=(x-xi)^2+(y-yi)^2-3*min^2;
D=solve(f1,f2,x,y)
D =
x: [2x1 sym]
y: [2x1 sym]
>> D.x
ans =
1/2*(-(2*min^2*yp-yp^2*yi+xi^2*yi-2*xi*xp*yp-2*xi*xp*yi+yp^3+xp^2*yi-yp*yi^2+xp^2*yp-2*min^2*yi+yp*xi^2+yi^3+(48*xi^2*xp^2*min^2+4*xp^4*yi*yp+4*xp^2*yi^3*yp+2*xi*xp*yi^4+8*xi*xp^3*yi^2+8*xi*xp^3*yp^2+2*xi*xp*yp^4-12*xi^2*xp^2*yp^2+4*xi^4*yi*yp+8*xi^2*yi^2*min^2+4*xi^2*yi^3*yp-12*xi^2*yi^2*xp^2+8*xi^3*yi^2*xp+4*yp^3*yi*xi^2+4*yp^3*yi*xp^2-6*yp^2*yi^2*xp^2-6*yp^2*yi^2*xi^2+8*min^2*yp^2*xi^2+8*min^2*yp^2*xp^2+8*xi*xp*min^4-32*xi^3*xp*min^2-32*xi*xp^3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