odes with variable coefficients
Show older comments
i am solving system of linear ode with time varying (gaussian )coefficients using standard ode45 approach but i am not getting desired results ,do i need to make some changes to accomodate time variartion of coefficients ? below i copy pasted from my m file along with command
% function dy=tarak(t,y)
g0=.1;
t0=200;
s=90;
g=g0*exp(-((t-t0)/s).^2);%time varying gaussian coefficient "g"
G=sqrt(10);
dy=zeros(5,1);
dy(1)=-2*2*y(1)+1i*G*conj(y(3))+1i*g*conj(y(4))-1i*G*y(3)-1i*conj(g)*y(4);
dy(2)=2*y(1)+1i*G*y(3)-1i*G*conj(y(3));
dy(3)=-2*y(3)+1i*G*y(2)+1i*g*conj(y(5))-1i*G*y(1);
dy(4)=-2*y(4)+1i*G*y(5)+1i*g*(1-y(1)-y(2))-1i*g*y(1);
dy(5)=1i*G*y(4)-1i*g*conj(y(3));
Command [T,Y] = ode45(@tarak,[0 ,500],[0 0 0 0 0]);
Thanks for your time
Accepted Answer
More Answers (1)
Torsten
on 18 Mar 2015
0 votes
Formally, everything looks fine. Of course we don't know if your underlying equations are correct.
Are you sure ODE45 can handle complex-valued ODEs ?
Best wishes
Torsten.
3 Comments
harman singh
on 18 Mar 2015
harman singh
on 23 Mar 2015
Edited: harman singh
on 23 Mar 2015
harman singh
on 1 Apr 2015
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!