필터 지우기
필터 지우기

ODE45 not enough input arguments

조회 수: 3 (최근 30일)
Tomas van Dorp
Tomas van Dorp 2016년 12월 19일
답변: Sally Al Khamees 2016년 12월 22일
I have been trying to solve 3 differential equations with ODE 45, but it keeps giving the error that there are not enough input arguments.
This is my function:
function du = Hopelijkgoed(t,u)
Qbin=(5.8333*(10^(-6)));
A=1.8 ;
deltaP=17861 ;
R= 50000;
D=(3.8*(10^(-12)));
d=(35*(10^(-6)));
Vb=0.0001;
Vm=0.00599;
Vd=0.0001;
Qdin=(5.8333*(10^(-6)));
s=3.153600;
a= (deltaP*A)/R; %deltaP= Drukverschil [N/(m^2)], A= Oppervlaktemembraan [m^2], R= Convectie membraan weerstand [(N*m^3)/mol]
b= (D*A)/d; %D= Diffusieconstante [(m^2)/s], A= Oppervlaktemembraan [m^2], d= Dikte membraan loodrecht [m]
du = zeros(3,1);
du(1) = (Qbin+a)*(u(2)/Vb)-((Qbin)*(u(1)/Vm))+s;
du(2) = (Qbin*((u(1)/Vm)-(u(2)/Vb)))+(b*((u(3)/Vd)-(u(2)/Vb)));
du(3) = (-(Qdin*(u(3)/Vd)))+((a-b)*((u(3)/Vd)-(u(2)/Vb)));
end
And this is the script that calls the function:
[T,U]=ode45(@Hopelijkgoed,[0 30],[0.2036 0.004 0]);
figure(1)
plot(T,U)
It keeps giving the error that there is an undefined function or variable 't' if i run the function.
  댓글 수: 1
Jan
Jan 2016년 12월 19일
편집: Jan 2016년 12월 19일
Please post a copy of the complete error message. It contain important details. Most of all the failing line is interesting, because the shown code does not contain the variable "t". This means, that the problem must happen somewhere else.
Use 5.8333e-6 instead of (5.8333*(10^(-6))). The first is a constant, while the 2nd is an expensive power operation.

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

답변 (1개)

Sally Al Khamees
Sally Al Khamees 2016년 12월 22일
I was able to execute the code successfully.
To verify, did you follow these steps to execute the code?
  1. Created a function file called "Hopelijkgoed.m" that has the function code.
  2. Created a script "test.m", and copy-pasted the script that calls the function in it. Or used the command window.
  3. executed "test.m", which in turn calls "Hopelijkgoed.m"
I receive "Not enough input arguments" error when I execute "Hopelijkgoed.m" first.
Also, have you tried debugging the code by inserting a break point where the error is and see if the variable "t" is defined before the call.
As Jan Simon suggested, provide the exact error message, or a screenshot of it.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by