# ODE45 not enough input arguments

1 vue (au cours des 30 derniers jours)
Tomas van Dorp le 19 Déc 2016
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 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Jan le 19 Déc 2016
Modifié(e) : Jan le 19 Déc 2016
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.

Connectez-vous pour commenter.

### Réponses (1)

Sally Al Khamees le 22 Déc 2016
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.
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Programming dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by