MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] 用solve解含小量的非线性方程组出现不同结果 (https://www.labfans.com/bbs/showthread.php?t=20660)

guohf 2014-04-21 17:59

用solve解含小量的非线性方程组出现不同结果
 
要解方程组
(x-6e-5)^2+(y-5e-5)^2=(8e-6)^2
x^2+(y-5e-5)^2=3.6e-9

[COLOR="red"]方程有实数解[/COLOR],可采用两种方法,得不到想要的结果,且会报错,请高手给看下,先谢了
法一:
>> ax=6e-5;ay=5e-5;
>> syms x y;
>> [x,y]=solve((ax-x)^2+(ay-y)^2-(8e-6)^2==0,x^2+(y-5e-6)^2-3.6e-9==0)

x, y得[COLOR="Red"]到很怪的复数解[/COLOR]。

将ax, ay的具体值代入,法二:
[x,y]=solve((x-6e-5)^2+(y-5e-5)^2-(8e-6)^2==0,x^2+(y-5e-6)^2-3.6e-9==0)

Error using mupadmex
Error in MuPAD command: Not a square matrix. [(Dom::Matrix(Dom::ExpressionField()))::_power]

Error in sym/privBinaryOp (line 1693)
Csym = mupadmex(op,args{1}.s, args{2}.s, varargin{:});

Error in sym/mpower (line 189)
B = privBinaryOp(A, p, 'symobj::mpower');
出现上面错误[COLOR="red"],不太理解这些“错误”指的是什么?[/COLOR]在网上查了一下,添加了点:
[x,y]=solve((x-6e-5).^2+(y-5e-5).^2-(8e-6)^2==0,x.^2+(y-5e-6).^2-3.6e-9==0)

Warning: [COLOR="red"]Explicit solution could not be found. [/COLOR]
> In solve at 179
x = [ empty sym ]
y = []

guohf 2014-04-22 10:39

回复: 用solve解含小量的非线性方程组出现不同结果
 
是我写错了,把第二个方程中的5e-5写成5e-6了,真马虎。
其实我要做一个循环,把这次得到的x, y值作为新的ax, ay值,再进行求解,第一种方法较实用一点了


所有时间均为北京时间。现在的时间是 13:01

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