About this ode function
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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')
0 comentarios
Respuestas (1)
Stephen Carter
el 15 de Oct. de 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.
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!