Help with Writing Function Files for Nonlinear Functions

1 visualización (últimos 30 días)
Marina Michael
Marina Michael el 5 de Oct. de 2019
Comentada: John D'Errico el 5 de Oct. de 2019
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 comentario
John D'Errico
John D'Errico el 5 de Oct. de 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.

Iniciar sesión para comentar.

Respuestas (1)

John D'Errico
John D'Errico el 5 de Oct. de 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 comentarios
Walter Roberson
Walter Roberson el 5 de Oct. de 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 el 5 de Oct. de 2019
Ah. I did not see that the picture was wider than what showed.

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by