When do we put quotes around the name of the function and when not ? For example, I used fsolve(myfun,x0) and I got no results , but when I used fsolve('myfun',x0) I got the root I was looking for ...
Thanks !! But I still don't get why fsolve(f,0) worked with f(x) = exp(x) - cos(x) - 1 and didn't work with f(x) = exp(x) - x^2 - 68 where I had to use the quotes or the function handle .
Ok i found out why it failed ! I had created and saved this function so I guess I had to use fsolve(@f,0) in first place ! Thanks a lot ! And one last thing :P I am a new Matlab user , and I haven't yet figured out how initial guesses work !For instance, I want to find out the roots of the equation F(X) = exp(x) - x^2 - 68 . What values should I put to x0 ? I 've tried several values close to 0 and I got the same result but I noticed I can't use very big numbers , whereas I can use very small numbers. If I want to find all the roots at F's domain range should I put more than one values at x0 ?
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
0 Comments
Sign in to comment.