Help with Writing Function Files for Nonlinear Functions

1 view (last 30 days)
Hi!
I am very new to MATLAB and have watched multiple videos about how to do this but I keep getting an error message saying there are not enough input arguments. Any help would be appreciated. Thank you!
  1 Comment
John D'Errico
John D'Errico on 5 Oct 2019
Show what you tried. Show the complete error message that you got. THEN ask for help on how to fix it. Otherwise, this becomes just us doing your homework for you.

Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 5 Oct 2019
Suppose you tried to use the MATLAB function mean. It takes at least one argument. What would happen, if you just tried typing mean at the command line however? TRY IT! Then think about what happens.
>> mean
Not enough input arguments.
Error in mean (line 74)
[flag, omitnan] = parseInputs(flag, flag2, isFlag2Set);
The point is, a function takes an argument, generally at least one of them. In fact, now look at the function header for the function that you wrote. (You have not shown that part. Sigh. If you really want help, then make it easier for someone to help you.)
Did you pass in the arguments of that function? q4 is apparently a function that you wrote. What does it expect to see?
  2 Comments
Walter Roberson
Walter Roberson on 5 Oct 2019
Scroll right to see the function header. The file is named q4.m but the function is named F. (In cases where a function file has a different function name than file name, MATLAB will use the file name rather than the function name.)
John D'Errico
John D'Errico on 5 Oct 2019
Ah. I did not see that the picture was wider than what showed.

Sign in to comment.

Categories

Find more on Startup and Shutdown 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!