1.3 plot the impulse and step responses of a system from its transfer function

Problem: Find the impulse and step responses for the continuous time system deﬁned by the transfer function $H\left ( s\right ) =\frac {1}{s^{2}+0.2s+1}$ and display these on the same plot up to some $$t$$ value.

Side note: It was easier to see the analytical form of the responses in Mathematica and Maple so it is given below the plot.

 Mathematica Clear["Global*"]; SetDirectory[NotebookDirectory[]] sys = TransferFunctionModel [1/(s^2 + 2/10 s + 1), s]; yStep = Assuming[t > 0, Simplify@OutputResponse[ sys, UnitStep[t], t]]  {1 - E^(-t/10) Cos[(3 Sqrt[11] t)/10] - ( E^(-t/10) Sin[(3 Sqrt[11]t)/10])/ (3 Sqrt[11])} 

 yImpulse = Simplify@ OutputResponse[sys,DiracDelta[t],t]  {(10 E^(-t/10) HeavisideTheta[t] Sin[(3 Sqrt[11] t)/10])/(3 Sqrt[11])} 

 p = Grid[{ {Plot[Evaluate@{yStep, yImpulse}, {t, 0, 50}, PlotRange -> {{0, 50}, {-0.8, 2.0}}, Frame -> True, FrameLabel -> {{"y(t)", None}, {t, "step and impulse reponse"}}, GridLines -> Automatic, GridLinesStyle -> Dashed, ImageSize -> {300, 300}, PlotStyle -> {Red, Black}, AspectRatio -> 1] }, {Row[{"step response=", Re@yStep}]}, {Row[{"impulse response=",Re@yImpulse}]} }, Alignment -> Left, Frame -> True] 

 Matlab clear all; close all; t = 0:0.05:50; s = tf('s'); sys = 1/(s^2+0.2*s+1); y = step(sys,t); plot(t,y,'-r') hold on y = impulse(sys,t); plot(t,y,'-k') title('Step and Impulse responses'); xlabel('t'); ylabel('y(t)'); xlim([0 50]); ylim([-0.8 2]); legend('step','impulse'); grid on; set(gcf,'Position',[10,10,310,310]); 

 Maple Using Maple DynamicSystems restart: alias(DS=DynamicSystems): sys:=DS:-TransferFunction(1/(s^2+0.2*s+1)): p1:=DS:-ResponsePlot(sys, DS:-Step(), duration=50,color=red,legend="step"): p2:=DS:-ImpulseResponsePlot(sys, 50, legend="impulse"): plots:-display([p1,p2],axes=boxed, title=step and impulse reponses); 

Using Laplace transform method:

 with(inttrans): with(plottools): H:=1/(s^2+0.2*s+1); input:=laplace(Heaviside(t),t,s): yStep:=invlaplace(input*H,s,t); input:=laplace(Dirac(t),t,s): yImpulse:=invlaplace(input*H,s,t); plot([yStep,yImpulse],t=0.001..50, title=step response, labels=[time,y(t)], color=[red,black], legend=["step","impulse"]); `