how can i solve an EDF?

조회 수: 1 (최근 30일)
triki
triki 2014년 4월 15일
댓글: Mischa Kim 2014년 4월 16일
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)

답변 (2개)

Mischa Kim
Mischa Kim 2014년 4월 15일
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
Mischa Kim
Mischa Kim 2014년 4월 15일
편집: Mischa Kim 2014년 4월 16일
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
Check out the DDE documatation for more detail.

댓글을 달려면 로그인하십시오.


triki
triki 2014년 4월 15일
Thank you for your help,but there is a little mistake,witch is my edf is not dy=y*(t-h) but dy=y(t-h). That's mean that y in the second member dependent on t-h not multiplied by (t-h);in other way we can suppose a x=t-h so our equation become: dy/d(x+h)=-y(x)
  댓글 수: 1
Mischa Kim
Mischa Kim 2014년 4월 16일
Please add follow-up questions and comments as comments, not answers.

댓글을 달려면 로그인하십시오.

카테고리

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