374 Chapter 6. Function Reference
Example
This example is identical to that described for sresidualize and compares the two
methodsof model reduction.
# Create a five state system for reduction.
a = daug(-0.891334,[-1.20857,0.799042;-0.799042,-1.20857],...
-4.74685,-21.3013)
b = [0.0262569;-0.189601;-0.113729;0.211465;-0.538239]
c = [0.120725,-0.336942,0.397198,-0.700524,-1.02235]
d=0
sys1 = system(a,b,c,d)
# Reduce to a 3 state system by residualization
# and truncation.
sysout1 = sresidualize(sys1,3)
sysout2 = truncate(sys1,3)
fHz = logspace(0.01,100,100)
sys1g = freq(sys1,fHz)
sysout1g = freq(sysout1,fHz)
sysout2g = freq(sysout2,fHz)
residerror = sys1g - sysout1g
truncerror = sys1g - sysout2g
gph1 = ctrlplot([sys1g,sysout1g,sysout2g,residerror,...
truncerror],{logmagplot});
gph1 = plot(gph1,{!grid,legend=["original system";...
"residualized system";"truncated system";...
"residualization error";"truncation error"]})?