# Question:How to plot response of more than one system in same plot? DynamicSystem

## Question:How to plot response of more than one system in same plot? DynamicSystem

This is a typical problem of what I find when learning DynamicSystems. Basically, I create number of systems by changing one paramter (the damping ratio in this case) and want to plot the unit step of all of them on the same plot to compare the effect of the damping ratio.

I setup the TransferFunction, used Simulate to obtain the response of each to the same input. The problem comes when I want to plot the respones.  I have to use plot[odeplot] it seems. But this only like to take one response at a time.

I can't use plot() since I do not have the actual function of the response in time. Unless I try to extract the differential equation from the sytem object, solve that and get a solution then use plot(). But if I do all of this, what do I need DynamicSystems in first place?

I will show what I tried. I am sure there is some way to do this in Maple I just do not know yet the correct function or setup.

restart;
alias(DS=DynamicSystems);
H:=(w,zeta)->w^2/(s^2+2*zeta*w*s+w^2);
sys:= (w,zeta)->DS:-TransferFunction(H(w,zeta)):
sol:=seq(DS:-Simulate(sys(1,zeta),Heaviside(t)),zeta=0.1..1.2,.2):

Now I want to plot all the solutions in sol. I wanted to use plot(...) only to be able to obtain the automatic coloring of each solution.

If I try to use plots[odeplot], it works, but only on one at a time:

plots[odeplot](sol[1],t=0..10);

If I try this, it fails:

plots[odeplot]([sol],t=0..10);

I can get each plot separatly and then use display() but then lose the automatic coloring of the lines:

plots:-display(seq(plots[odeplot](sol[i],t=0..10),i=1..nops([sol])));

I am looking for the above plot, but have the lines each colors differently. I also need to figure how to add legend later. But one step at a time. I can't hard code the color in the plots[odeplot] call itself, since I do not know what color to give each line. plot([....],t=0..) allready does this automatically. But I can't use it!

Just to give an idea of the kind of plot I am trying to obtain, here it is in Mathematica:

sys = TransferFunctionModel[w^2/(s^2 + 2 z*w*s + w^2), s];
zValues = Range[.2, 1.2, .2];
fun = OutputResponse[sys /. {w -> 1, z -> #}, UnitStep[t], {t, 0, 12}] & /@ zValues;
Plot[Evaluate@Flatten@Table[fun[[i]], {i, 1, Length[fun]}], {t, 0, 12}, Frame -> True, PlotRange -> {{0, 12}, {-.1, 1.7}}]

﻿