clf reset; F='[-i*cos(t)*exp(i*t)*y(2);-i*cos(t)*exp(-i*t)*y(1)]'; func=inline(F,'t','y'); [t,y]=ode23(func,[0.01,100],[0,1]); t1=0:0.01:100; c2=exp(-i.*t1/2).*sin(sqrt(5/4).*t1); hold on; plot(t,imag(y(:,1))); plot(t1,imag(c2),'r');