Can x0 in fsolve() be a symbol or has to be numerical?

2 views (last 30 days)
Hi I used solve() to solve the following single variable exponential equation. (solving with respect to tm)
K+P*exp(gh*tm)-L*exp(gl*tm)+M*exp(gl*tm)+N*exp(gl*tm)-(gh*tm*P*exp(gh*tm))+(gl*L*tm*exp(gl*tm))-(gl*M*tm*exp(gl*tm))-(gl*N*tm*exp(gl*tm))=0
I get a warning Explicit solution could not be found. > In solve at 81
How can this be solved. If I use fsolve() would it work? Also can x0 be a symbol in fsolve(fun,f0) or does it have to be a numerical?
Thanks in advance!

Answers (1)

Walter Roberson
Walter Roberson on 31 Aug 2011
Are you using the MuPad based symbolic toolbox? If so, then when solve() is not able to find an analytical solution in MuPad, it automatically attempts to find a numeric solution (if I recall correctly.) If no numeric solution could be found, then fsolve() is not going to work any better.
Which of your symbols have specific numeric values at the time you attempt the solve() ?
In MATLAB, you need to distinguish between fsolve() and numeric::fsolve . fsolve() in the form you indicate cannot handle symbolic variables at all. numeric::fsolve is the symbolic toolbox routine to (try to) find numeric solutions to symbolic equations. There is no direct MATLAB to the symbolic toolbox's numeric::fsolve so you would have to use evalin(symengine,'...') to call upon it.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!