find the root of a function in an interval
41 views (last 30 days)
I would like to solve an expontential function f in an interval, say, [0,e]. I try to use solve but it is very slow. Then I try to use fzero .It is faster but still not efficient enough. As I want the solution to be in the interval, I think it should be more efficient if I can specifiy the interval. Luckily fzeros allows me to do so. But meanwhile it requires the value of function f changes sign in the boundadry of the interval. I can not guarantee f(0) has a different sign as f(e) so fzero is not working...Could you give me some advice about this? Here is an example of the code
and I get the error messages is
% Error using fzero (line 274)
The function values at the interval endpoints must differ in sign.