error solving stiff ODE system with ode15s
22 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Walter Roberson
2017 年 8 月 6 日
Change to
[t,y]=ode15s(@odelad,tspan,y0);
2 件のコメント
Jan
2017 年 8 月 6 日
編集済み: Jan
2017 年 8 月 6 日
@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.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!