352 Chapter 6. Function Reference
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"]})?