Quotes around the name of the function
조회 수: 11 (최근 30일)
표시 이전 댓글
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 ...
댓글 수: 0
채택된 답변
Matt Fig
2012년 12월 15일
편집: Matt Fig
님. 2012년 12월 15일
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.
추가 답변 (0개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!