MATLAB Answers

Jiao He

Not enough input arguments

Asked by Jiao He
on 29 Nov 2011
function dy= test(t,y)  
dy = zeros(2,1); 
dy(2)=y(1)./t-y(2).*t;  (error in this line)

Error using test(line 3) Not enough input arguments

Can somebody help me to find the problem please? Thanks

  1 Comment

Jan Simon
on 29 Nov 2011

Please format your code as explained in the "Markup help" link on this page.



No products are associated with this question.

3 Answers

Answer by Matt Tearle
on 29 Nov 2011

From your comment to Jan: "then run it"...

If you are running it as a script then it will give this error message because test is a function, requiring t and y to be passed in as arguments. Call it as a function and it should work fine:

>> test(pi,rand(2,1))
ans =


Answer by Jan Simon
on 29 Nov 2011

I guess, that you have a function called "t":

which t

Please post the complete error message in the future. It contains helpful information.

  1 Comment

Jiao He
on 29 Nov 2011

I was trying to solve the following differential equations:

parameters in the equations are time dependent.
I save this function as test.m, then run it, returns :
Error using test(line 3)
Not enough input arguments.

Answer by Walter Roberson
on 29 Nov 2011

What arguments are you passing to test when you invoke it?


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!