342 Chapter 6. Function Reference
inps = "ref"
outs = "digP"
cnx = ["digC"; ... # input to digP
"[ ref;digP]"] # input to digC
digclp = sysic(snm,inps,outs,cnx,digP,digC)
# Calculate the digital system step response
time = [0:T:20*T]
step = gstep(time,0,1)
digy = digclp*step
# Do a complete sampled data simulation. We
# will assume that the controller has an input to
# output calculation delay of 0.1*T. The
# plant will also have a non-zero initial
# condition and a sinusoidal disturbance will
# be imposed at the output. The disturbance has
# deliberately been chosen at above the Nyquist
# frequency.
#P = system(P,x0=[0.25;0]) # initial condition
calcdelay = 0.1*T # calculation delay
finetime = [0:0.005:1]
dist=0.25*gsin(finetime,frequency=11) # disturbance
step = gstep(finetime,0,1) # step
# calculate the continuous time part of the
# system as the upper LFT object.
ctssys = consys([0,1,1;1,0,0;0,1,1])*daug(1,1,P)
ctssys = system(ctssys,x0=[0.25;0])
ctsy = sdtrsp(ctssys,digC,[step;dist],...
cdelay=calcdelay)
gph1 = ctrlplot(ctsy);
gph1 = plot(gph1,digy,{line=0,marker=1,...
legend= ["sampled data calc.";"discrete calc."]})?