how can i solve an EDF?
Mostrar comentarios más antiguos
How can i solve an equation having this form with Matlab : dy+y(t-h)=0 and plotting it's variation on the time with différents values of h .(h is a constant)
Respuestas (2)
Mischa Kim
el 15 de Abr. de 2014
Triki, use one of the numerical integrators, e.g. ode45
function ODEsim()
tspan = 0:0.1:10; % set up the problem
IC = 1;
h = 0.5;
[t,yt] = ode45(@myODE,tspan,IC,[],h); % call the integrator
plot(t,yt,'r') % plot the result
xlabel('t')
ylabel('y')
grid
end
function dy = myODE(t,y,h) % define the DE
dy = -y*(t - h);
end
1 comentario
Mischa Kim
el 15 de Abr. de 2014
Editada: Mischa Kim
el 16 de Abr. de 2014
Ok, I see.
function DDEsim()
h = 1;
lag = h;
sol = dde23(@DDEeq,lag,@DDEhist,[0,5]);
plot(sol.x,sol.y);
xlabel('t');
ylabel('y');
end
function dydt = DDEeq(t,y,Z)
ylag = Z(:,1);
dydt = -ylag;
end
function S = DDEhist(t)
S = 1;
end
triki
el 15 de Abr. de 2014
0 votos
1 comentario
Mischa Kim
el 16 de Abr. de 2014
Please add follow-up questions and comments as comments, not answers.
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!