To show some of the possibilities of the toolbox to model digital system we introduce usual notation for a closed loop model
In our example we will assume that we know the pzmodel of the filter, H, and the open loop gain (OLG). These are related with the closed loop gain (CLG) by the following equation
We want to determine H and CLG. We would also like to find a digital filter for H, but we will deal with this in the following section.
Imagine that we have somehow managed to find the following model for OLG
Key | Value |
---|---|
GAIN |
4e6 |
POLES |
1e-6 |
then we can create a pzmodel with these parameters as follows
OLG = pzmodel(4e6,1e-6,[],'OLG')
---- pzmodel 1 ----
name: OLG
gain: 4000000
delay: 0
iunits: []
ounits: []
pole 001: (f=1e-06 Hz,Q=NaN)
-------------------
To introduce the second model, the one describing H, we will show another feature of the pzmodel constructor. We will read it from a LISO file, since this contructor accepts this files as inputs. We can then type
H = pzmodel('LISOFile.fil')
M: load file: LISOFile.fil
---- pzmodel 1 ----
name: opd_digi_100_iir1
gain: 1000000000
delay: 0
iunits: []
ounits: []
pole 001: (f=1e-06 Hz,Q=NaN)
pole 002: (f=1e-06 Hz,Q=NaN)
zero 001: (f=0.001 Hz,Q=NaN)
-------------------
H.setName;
G = OLG/H ---- pzmodel 1 ---- name: (OLG./H) gain: 0.0040111 delay: 0 iunits: [] ounits: [] pole 001: (f=1e-06 Hz,Q=NaN) pole 002: (f=0.001 Hz,Q=NaN) zero 001: (f=1e-06 Hz,Q=NaN) zero 002: (f=1e-06 Hz,Q=NaN) -------------------
G.setName; G.simplify M: cancelling pole (f=1e-06 Hz,Q=NaN) and zero (f=1e-06 Hz,Q=NaN) ---- pzmodel 1 ---- name: simplify((OLG./H)) gain: 0.0040111 delay: 0 iunits: [] ounits: [] pole 001: (f=0.001 Hz,Q=NaN) zero 001: (f=1e-06 Hz,Q=NaN) -------------------
pl = plist('f1',1e-3,'f2',5,'nf',100); CLG = 1/(1-resp(OLG,pl)); CLG.setName;
You can now repeat the same procedure but loading a H model with a delay from the LISO file 'LISOFileDelay.fil'
H = pzmodel('LISOFileDelay.fil')
M: load file: LISOFileDelay.fil
---- pzmodel 1 ----
name: LISOfileDelay
gain: 4000000
delay: 0.0174
iunits: []
ounits: []
pole 001: (f=1e-06 Hz,Q=NaN)
-------------------
you will see how the delay is correctly handled, meaning that it is added when we multiply two models and substracted if the models are divided.