%Damped oscillation y''+b*y'+4y=0
%Equivalently the 1st order linear system y'=v, v'=-4y-b*v


figure(1);
b=1;
[y,v]=meshgrid(-4:0.5:4,-4:0.5:4);
yp=v;vp=-4*y-b*v;
quiver(y,v,yp,vp);
axis tight;
hold on;

F=@(t,z)[z(2);-4*z(1)-b*z(2)];
[t,z]=ode45(F,[0 10],[1;4]);
plot(z(:,1), z(:,2),'LineWidth',1);
hold off;


figure(2);
plot(t, z(:,1),'r','LineWidth',2);
hold on
plot(t, z(:,2),'b','LineWidth',2);
hold off;


