Filter löschen
Filter löschen

About this ode function

1 Ansicht (letzte 30 Tage)
qingze
qingze am 15 Okt. 2014
Kommentiert: qingze am 15 Okt. 2014
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')

Antworten (1)

Stephen Carter
Stephen Carter am 15 Okt. 2014
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 Kommentar
qingze
qingze am 15 Okt. 2014
How should I set y(4)=-3 as initial value?

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by