Error: Unrecognized function or variable 'FunExample2'. / Error in Newton Root (line 15)

1 view (last 30 days)
I am not very familiar with MATLAB, but use it as a tool in my Numerical Methods class. I have taken a C class before so I do have a general idea of how to debug, but I really have no idea with this one.

Answers (1)

Walter Roberson
Walter Roberson on 22 Oct 2020
You have stored FunExample2 and FunDerExample2 inside the same file NewtonRoot.m .
There are valid reasons to do something like that, but a side effect of doing that is that it is difficult to get a handle to any function other than the first one from outside of the function file, such as at the command line.
You should put FunExample2 into FunExample2.m and FunDerExample2 into FunDerExample2.m

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!