Not enough input arguments

function dy= test(t,y)
dy = zeros(2,1);
dy(1)=t-y(1)./t;
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

Jan
Jan 2011년 11월 29일
Please format your code as explained in the "Markup help" link on this page.

댓글을 달려면 로그인하십시오.

답변 (3개)

Matt Tearle
Matt Tearle 2011년 11월 29일

1 개 추천

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 =
3.1230e+000
-2.9509e+000
Jan
Jan 2011년 11월 29일

0 개 추천

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

Jiao He
Jiao He 2011년 11월 29일
I was trying to solve the following differential equations:
dy1/dt=t-y1/t
dy2/dt=y1/t-2*t
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.

댓글을 달려면 로그인하십시오.

Walter Roberson
Walter Roberson 2011년 11월 29일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

질문:

2011년 11월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by