About this ode function

1 回表示 (過去 30 日間)
qingze
qingze 2014 年 10 月 15 日
コメント済み: qingze 2014 年 10 月 15 日
I want to calculate this ode function with initial value y(4)=-3. But it shows not enough input error at line
dy= (K1*t+K2*y-az)/(K3*t+K4*y+kz); Can someone help please? Thanks!
function dy = coexistline(t,y)
K1 =4.9493e-04;
K2 =-1.0058e-04;
K3 =1.0058e-04;
K4 =0.0081;
az = 0.088235;
kz = -1.65625;
%dy = zeros(1,1); % a column vector
dy= (K1*t+K2*y-az)/(K3*t+K4*y+kz);
options = odeset('RelTol',1e-4,'AbsTol',[1e-4 1e-4 1e-5]);
[T,Y] = ode45(@coexistline,[-10 10],-3,options);
plot(T,Y,'-o')

回答 (1 件)

Stephen Carter
Stephen Carter 2014 年 10 月 15 日
I think 'AbsTol',[1e-4 1e-4 1e-5] is your problem. Since your solution has only one component for each timestep, I believe your tolerance also needs to be scalar. Try 'AbsTol',1e-4 instead.
And... looking further at what you said... you say you want initial value y(4)=-3. Do you mean you want y to equal -3 at t=4? If so, then your input is wrong. You seem to put y as -3 at time -10.
  1 件のコメント
qingze
qingze 2014 年 10 月 15 日
How should I set y(4)=-3 as initial value?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by