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 CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by