Hey guys, I just started using matlab. Why is this showing as the function being undefined
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Answers (2)
Walter Roberson
on 21 May 2017
0 votes
Notice that at the top it still says "Untitled". You have not saved your code into my_equation.m . Also, my_equation compared to myequation matters.
4 Comments
German Bu
on 21 May 2017
Star Strider
on 21 May 2017
Are you saving it to a directory on your MATLAB search path?
To find out what the path is, type path in the Command Window.
German Bu
on 21 May 2017
Walter Roberson
on 21 May 2017
What does
which -all my_equation
show?
EngEdgarHS
on 21 May 2017
1º Try this:
function [x] = myequation(a, b, c)
top = sqrt(b-4*a);
botton = c^7;
x = (b+top)/botton;
2º Save your code in appropriated directory with same name of function (myequation.m)
3º Select folder where myequation.m is saved and try this:
x = myequation(1,2,3);
Regardles.
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!