MATLAB: Quotes around the name of the function

fsolvefunctionsfzeroMATLABquotesrootssingle

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 …

Best Answer

Typically, you want to pass a handle to a function, not a string.
fsovle(@myfun,x0) % Notice the @ symbol --> a function handle.
The string argument gets evaluated the same way, probably for backward compatibility. The modern way is to use function handles.