Differential Equation Matlab Resolve

2 views (last 30 days)
Alexmm
Alexmm on 14 Jul 2014
Answered: Andrei Bobrov on 15 Jul 2014
Hello everyone, I can not resolve / implement the follow differential equation. Is there anyone who can help me??
y''(t)+p(t)y'+q(t)y=0
q=1/(1+t)^2;
p=1+q;
y(0)=1; y'(0)=0; y''(0)=0; ------> y'(4*pi)=??

Answers (2)

Andrei Bobrov
Andrei Bobrov on 15 Jul 2014
Your odefun - funnn:
function dy = funnn(t,y)
q = 1./(1+t).^2;
dy = [ y(2);
-((q + 1).*y(2) + q.*y(1))];
end
solve:
sol = ode45 (@funnn, [0 20], [1 0]);
out = deval(sol,4*pi,2);

MiguelMauricio
MiguelMauricio on 15 Jul 2014
Try using dsolve
syms y(t) t
q=1/(1+t)^2;
p=1+q;
Dy=diff(y);D2y=diff(y,2);
solution=dsolve(D2y+p*Dy+q*y==0,Dy(0)==0,y(0)==1,t)
In any case, your last initial condition (y''(0) must be wrong since the equation would not hold. For t=0 you would have 0 + 2*0 + 1*1=0

Community Treasure Hunt

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

Start Hunting!