228 Chapter 6. Function Reference
# Create a second order lightly damped system to illustrate
# time response plotting. The calculation is repeated with
# a non-zero initial condition.
sys = 5/makepoly([1,1,5],"s")
u = gstep([0:0.05:10],[0;1;5],[0;1;-1])
y0 = sys*u
[a,b,c,d] = abcd(sys)
sys = system(a,b,c,d)
y1 = system(sys,{X0=[-1;0]})*u
# Now plot the result
g1 = ctrlplot(u,{line style=2});
g1 = ctrlplot(y0,g1,{line style=1});
g1 = ctrlplot(y1,g1,{line style=4});
g1 = plot(g1,{!grid,legend=["input";"x0 = zero";"non-zero x0"]})?