error solving stiff ODE system with ode15s
22 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
the "Not enough input arguments" error pops up every time I run my code, the idea is that N is the spatial coordinate, and I am trying to solve the time dependency for every discrete point in space at a time, the equation for each point in space depends on the solutions for all the points before it, here is my attempt at it:
tspan=[0 logspace(1,5)];
y0=zeros(length(N));
[t,y]=ode15s(odelad,tspan,y0);
where odelad is in a separate .m file:
function dydt=odelad(t,y)
D0=5.8e-11;
IUV=1;
n=30;
sig_g=1;
alpha_G=IUV*D0;
R=3e-17;
N=logspace(17,23);
for i=1:length(N)
N_(i)=n*sum(y(1:i));
end
dydt=(R*n).*(1-2.*y)-(alpha_G/2).*f_DB96(N_)*exp(-sig_g.*N);
also f_DB96(N) is a separate function saved in the same folder, but it didn't even get that far and the erorr I keep getting:
Not enough input arguments.
Error in odelad (line 11)
N_(i)=n*sum(y(1:i));
Error in tester (line 27)
[t,y]=ode15s(odelad,tspan,y0);
help please !
0 commentaires
Réponse acceptée
Walter Roberson
le 6 Août 2017
Change to
[t,y]=ode15s(@odelad,tspan,y0);
2 commentaires
Jan
le 6 Août 2017
Modifié(e) : Jan
le 6 Août 2017
@Elad Oz: If this is not clear immediately: Your code ode15s(odelad,tspan,y0) includes a call of the function odelad() without input arguments, while Walter's code provides a handle to the function as 1st input to ode15s. The error message mentions the problem clearly and you can use the debugger to find the reason by your own: Set a breakpoint in the failing line and type in the input arguments in the command line, until you understand, what's going on.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations 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!