在MATLAB中求解指数方程 [英] Solving Exponential equation in MATLAB
问题描述
我现在正在尝试在MATLAB中求解指数方程式,这是我的作业的一部分.很容易看到方程式
I am now trying to solve an exponential equation in MATLAB as a part of my assignment. It is easy to see that the equation
exp(-t)+t*exp(-t)-n=0
将有两种解决方案,一种大于零,一种较小.
would have two solutions, one greater than zero and one smaller.
但是,仅使用Solve函数,MATLAB返回一个称为lambertw函数,它只能将eval()返回零以下的解,而这恰恰不是我想要的答案.有人可以在这里帮助我吗?
However, using just the solve function, MATLAB returns something called lambertw function and it can only eval() to the solution below zero, which happens not to be the one I want for the answer. Could anyone help me here?
提前感谢所有答案和评论!
Thanks in advance for all the answers and comments!
p.s.作为替代方案,我正在考虑使用Newton-Raphson方法来解决它,但是我想知道与Solve()相比,速度如何?
p.s. As an alternative, I am thinking about using Newton-Raphson method to solve it, but I wonder how is the speed comparing to solve()?
子尧伟
推荐答案
lambertw
是您需要的功能.但是,它是一个多值函数,并且具有多个分支.您需要选择正确的分支来回答.参见另一个问题,关于如何为解决方案选择其他分支.
lambertw
is the function that you need. However, it is a multivalued function and has several branches. You need to choose the right branch for your answer. See my answer to another question on how to choose a different branch for the solution.
这篇关于在MATLAB中求解指数方程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!