Hi Sean,
you can pass the value of epsilon into the ode function with
[tSol,YSol]=ode45(@(t,Y) quantumsystem(t,Y,epsilon),tRange,Y0);
and
function dYdt = quantumsystem(t,Y,epsilon);
x=Y(1);
y=Y(2);
z=Y(3);
gamma=1/2;
c=1;
dtheta=gamma*c/(t^2 + c^2);
dxdt=(-1/epsilon)*y - dtheta*z;
dydt=(1/epsilon)*x;
dzdt=dtheta*x;
dYdt=[dxdt;dydt;dzdt];
end
Since ode45 picks the time increments, different values of epsilon may lead to different lengths of tSol and YSol, but the information is there. One of the easier ways to deal with that issue is to set up a for loop with different values of epsilion and use
inside the loop as you are doing, only without the color specification.
Best Answer