m=2; c=2; k=1; x0=[1; 0]; tspan=[0 10]; options=odeset('RelTol',1e-5,'AbsTol',1.e-5); [t,x]=ode45('fcnspring',tspan,x0,[],m,c,k); plot(t,x(:,1),'b-*',t,x(:,2),'r-v') grid on xlabel('Time') ylabel('Displacement and Velocity') title('Spring-Mass-Dashpot System Solution') legend('Displacement','Velocity',0)