matlab 指数方程求解,在MATLAB中求解指数方程

在下面的代码中,我在数值上求解n=0.5(常数)的等式,但是它对于您选择的其他值应该是相似的。

注意SOLVE函数只返回找到的第一个解决方案。因此,我直接调用MuPAD发动机,每一次在其中的间隔来搜索该溶液指定:

%# lets plot the function: f(x) = exp(-x)+x*exp(-x)

h(1) = ezplot('0.5', [-1.5 10]); hold on

h(2) = ezplot('exp(-x)+x.*exp(-x)', [-1.5 10]);

set(h(1), 'LineStyle',':', 'Color','r')

legend(h, 'y = 0.5', 'y = exp(-x)+x.*exp(-x)')

%# The numeric solver only returns the first solution that it finds

x = solve('exp(-x)+x*exp(-x)=0.5')

x = vpa(x)

%# we can call the MuPAD solver and give the interval where solution can be found

x1 = evalin(symengine, 'numeric::solve(exp(-x)+x*exp(-x)=0.5, x = -1..0)')

x2 = evalin(symengine, 'numeric::solve(exp(-x)+x*exp(-x)=0.5, x = 0..3)')

%# show the solutions on the plot

plot([x1 x2], 0.5, 'ro')

通过SOLVE返回的溶液:

x =

- 1.0*lambertw(0, -1/(2*exp(1))) - 1.0

x =

-0.76803904701346556525568352607755

MuPAD数字解决方案:

x1 =

-0.76803904701346556525568352607755

x2 =

1.6783469900166606534128845120945

fa8a1f62e31e93e96d48fc5213bd0d52.png

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值