great2001 发表于 2005-9-9 16:01:16

[求助]请教一下关于 solve 函数的问题

最近运用Matlab时遇到下面的问题,还请高手指教
假如:
a=1;
b=2;
c=3;
d=4;
f=5;
solve('a*exp(b*x)+c*exp(d*x)-f=0')为什么该命令无法执行,但是:
solve('1*exp(2*x)+3*exp(4*x)-5=0')却能运行?这是怎么回事?
如果solve无法解决,那还有什么函数可以?

*午夜流星* 发表于 2005-9-9 18:57:45

Re:[求助]请教一下关于 solve 函数的问题

''引号是不传递外值的。可以如下:
solve(a*exp(b*x)+c*exp(d*x)-f)

bainhome 发表于 2005-9-9 19:30:02

Re:[求助]请教一下关于 solve 函数的问题

刚才试了一下,这个表达式本身好像不能执行(但午夜流星的方法对于可得到解析解的表达式是正确的),说明如下:
用正常的solve命令产生下面的提示:
>> solve(a*exp(b*x)+c*exp(d*x)-f)
??? Error using ==> solve
Unable to evaluate expression.
我用maple命令做了一下,产生了一个maple内部的 implicit solutions ,maple对其说明如下:
- In general, explicit solutions in terms of radicals for polynomial equations
of degree greater than 4 do not exist. In these cases, implicit solutions are
given in terms of RootOfs. Note that explicit solutions for the general
quartic polynomial equation are not by default given because they are too
complicated and messy to be of use. By setting the global variable
_EnvExplicit to true then solve will return explicit solutions for quartic
polynomials in all cases. By setting _EnvExplicit to false, all solutions
which are not rational will be reported as RootOfs.
代入具体数据能够求解个人猜测是具体解或者避免了求解过程中解析符号解的一些内部讨论,所以得到了正解.
另外用fsolve也可以得到数值的实数解
f1=inline('exp(2*x)+3*exp(4*x)-5','x');
fsolve(f1,1)
Optimization terminated successfully:
First-order optimality is less than options.TolFun.
ans =
    0.0633
复数解无法得到.
方便看起见我用maple软件解了一下(当然和在matlab内部调用得到结果相同),得到的结果和上面E文内的说明有点联系.

great2001 发表于 2005-9-9 20:54:18

感谢大家的帮助!

感谢斑竹和bainhome的帮助,没有你们的指点不知猴年马月我才能搞清这个问题!呵呵

臭臭 发表于 2010-11-22 02:18:17

2# *午夜流星*
“引号是不传递外值的”
哥们,你这句话太有用了!
感谢感谢!
页: [1]
查看完整版本: [求助]请教一下关于 solve 函数的问题