









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










+
_
+
_
Process
Sensor
Electronic Control
DAC
ADC
Discrete Time Steps Continuous in Time
Fs
Digital Control and/or Compensation
Method #1: Perform everything in the s-domain and then convert to the z-domain.
Derive and define (for example)
s b
s a G (^) c s K
Then, convert to a digital controller of the form
z B
z A D z C −
Where
aT A e
−⋅ = and
bT B e
−⋅ = , and computing the value of C for a steady state response
b
a G (^) c 0 = K ⋅
b
a K −
b
a C K −
Method #2: Use a z-domain root locus, staying in the digital domain
K Gz Dz
Rz
Y z
The characteristic equation is
and all conditions and/or requirements for forming the root locus (now in the z-domain)
are identical to the continuous time case. See Table 13.4 on p. 922!
Evaluation of the root locus must now be done using the z-domain (unit circle) stability
criteria.
Example 13.7 Method #1: Plant compensated with a phase-lead network
s s
2 − ⋅ +
z z
z Gz
Phase lead compensation to provide 45 deg. margin at w=125 rad/sec.
s
s G (^) c s
Converting the compensation to a digital compensator for T=0.001,
z B
z A D z C −
Where 0. 9512
− A e and 0. 7320
− B e and 4. 85 1 0. 9512
z
z Dz
Example 13.8 Root Locus of a second order system
2
s
G (^) p s =
2
2
z
T z Gz
2 1
z
z G (^) p z
2 1
z
z z K
np=2, nz=
poles at +1, +1, zero at –
breakaway ponts
2
2 2
z
z
z
z
z
z
z
pz
(^2 ) = ⋅ z − ⋅ z + − z − = z + z − = z + ⋅ z −
The breakaway points are at –3 and +1.
Plotting the root locus
Note that this system is marginally stable for K=0 and unstable for all other values of K!
Example 13.9 Compensating the unstable system
z b
z a D z K −
2
s
G (^) p s =
2
2
z
T z Gz
2 1
z
z Gz
2 1
z
z
z b
z a z K
In the digital domain (when all digital) exact cancellation is possible …
Therefore, make a=+1 and set b as desird …
2 −
z
z
z b
z
z
z b
z z K
Any value of b inside the unit circle will produce a root locus that provides a stable
solution.
Design Method #3: Digital PID Controller
Using first order approximations,
= ⋅ rk − rk − T
xk
I c P s K s
G s = K + + ⋅
Becomes (summed in the discrete time domain)
= ⋅ + ⋅ − 1 + ⋅ + ⋅ ⋅ rk − rk − T
x k KP rk KI xk T rk KD
Or an alternate form (based on the text)
= ⋅ − + + ⋅ + rk T
rk T
x k K xk K K T
D D I P I
Becomes (summed in the impulse z-transform)
T z
z K z
K T z G z K D
I c P ⋅
Time response
T z
z K z
K T z K Rz
X z D
I P ⋅
2 2 1 1 z 1 T
X z z z Rz K z z K T z
D P I
z T
z T
X z z X z z Rz K z K z K T z
D D D P P I
2 2 2 2
− 1 − 1 − 1 − 2 z T
z T
X z X z z Rz K K z K T
D D D P P I
− 1 − 1 − 1 − 2 z T
z T
X z X z z Rz K K z K T
D D D P P I
= − + + ⋅ + rk T
rk T
rk K T
x k xk K K T
D D P
D P I
I am not going to resolve the difference at this time …
help remez
REMEZ Parks-McClellan optimal equiripple FIR filter design. B=REMEZ(N,F,A) returns a length N+1 linear phase (real, symmetric coefficients) FIR filter which has the best approximation to the desired frequency response described by F and A in the minimax sense. F is a vector of frequency band edges in pairs, in ascending order between 0 and 1. 1 corresponds to the Nyquist frequency or half the sampling frequency. A is a real vector the same size as F which specifies the desired amplitude of the frequency response of the resultant filter B. The desired response is the line connecting the points (F(k),A(k)) and (F(k+1),A(k+1)) for odd k; REMEZ treats the bands between F(k+1) and F(k+2) for odd k as "transition bands" or "don't care" regions. Thus the desired amplitude is piecewise linear with transition bands. The maximum error is minimized.
For filters with a gain other than zero at Fs/2, e.g., highpass and bandstop filters, N must be even. Otherwise, N will be incremented by one.
B=REMEZ(N,F,A,W) uses the weights in W to weight the error. W has one entry per band (so it is half the length of F and A) which tells REMEZ how much emphasis to put on minimizing the error in each band relative to the other bands.
B=REMEZ(N,F,A,'Hilbert') and B=REMEZ(N,F,A,W,'Hilbert') design filters that have odd symmetry, that is, B(k) = -B(N+2-k) for k = 1, ..., N+1. A special case is a Hilbert transformer which has an approx. amplitude of 1 across the entire band, e.g. B=REMEZ(30,[.1 .9],[1 1],'Hilbert').
B=REMEZ(N,F,A,'differentiator') and B=REMEZ(N,F,A,W,'differentiator') also design filters with odd symmetry, but with a special weighting scheme for non-zero amplitude bands. The weight is assumed to be equal to the inverse of frequency times the weight W. Thus the filter has a much better fit at low frequency than at high frequency. This designs FIR differentiators.
B=REMEZ(...,{LGRID}), where {LGRID} is a one-by-one cell array containing an integer, controls the density of the frequency grid. The frequency grid size is roughly LGRIDN/2BW, where BW is the fraction of the total band interval [0,1] covered by F. LGRID should be no less than its default of
Increasing LGRID often results in filters which are more exactly equi- ripple, at the expense of taking longer to compute.
[B,ERR]=REMEZ(...) returns the maximum ripple height ERR.
[B,ERR,RES]=REMEZ(...) returns a structure RES of optional results computed by REMEZ, and contains the following fields:
RES.fgrid: vector containing the frequency grid used in the filter design optimization RES.des: desired response on fgrid RES.wt: weights on fgrid RES.H: actual frequency response on the grid RES.error: error at each point on the frequency grid (desired - actual) RES.iextr: vector of indices into fgrid of extremal frequencies RES.fextr: vector of extremal frequencies
See also CREMEZ, FIRLS, FIR1, FIR2, BUTTER, CHEBY1, CHEBY2, ELLIP, FREQZ, FILTER, and, in the Filter Design Toolbox, GREMEZ.
Fixed Filter Types Available
See also BARTLETT, BARTHANNWIN, BLACKMAN, BLACKMANHARRIS, BOHMANWIN, CHEBWIN, GAUSSWIN, HAMMING, HANN, KAISER, NUTTALLWIN, RECTWIN, TRIANG, TUKEYWIN.
In general:
Set up the differential equation (or let MATLAB do it)
Use the delta form with a sufficiently high sample rate, Ts.
Derive the step-by-step solution as shown.
If the sample rate is high enough, there are more tricks:
Derivatives: Use a first order difference,
s
k k
T
x x
t
x
t
Δ
Integral: Use a summation, (^) ∑ ∫ x ⋅ dt = Ts ⋅ xk
A fancy derivatives: 2 2 2 2
tan
t
t
t
a
(Useful for FM demodulation)
a(1)=0;
u=1;
for ii=1:
a(ii+1)=(1-1/32)a(ii)+(1/32)u;
end
plot
plot(a)
grid
How much memory storage is required? 1 variable, a
Can you shift and add instead of multiply? Yes 1/32 is 2^-5, a right shift by 5 places.
So, subtract a from a shifted a and then add a shifted u.
Do you want to “average” a string of inputs instead of using the instantaneous values?
This is a simple low pass filter that ignores rapid changes, particularly noisy
signal inputs.
Example 13.11 Fly-by-wire aircraft control surface
s s
G (^) P s
−
s s s
e Gs G s G s
sT
ZOH P
− −
1
2
1 2
1
s s s
z Z s s
Gz z Z
Using Table 13.
− T z e
z
z
z
z
T z
s s s
2 2
Substituting
−
− T z e
z
z
z
z
T z G z z 1 1
2
1
T
T T T
z z e
z T e T e e G z −
− − −
z z
z Gz
Using the root locus grid
Root Locus
Real Axis
Imaginary Axis
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
-0.
-0.
-0.
-0.
0
1
π/T
0.1π/T
0.2π/T
0.3π/T
0.4π/T 0.5π/T
0.6π/T
0.7π/T
0.8π/T
0.9π/T
π/T
0.1π/T
0.2π/T
0.3π/T
0.4π/T
0.5π/T 0.6π/T
0.7π/T
0.8π/T
0.9π/T
The ζ = 0. 7 contour can be seen.
exp = − = ⎟
≤ − ⋅ sample settle
z
Using a cancellation method and :
z z
z Gz
Let
z p
z D z K
Then
z K z z p
z D z Gz K Total − ⋅ +
Computing the breakaways
2
z
z z p
z
z
z
z p
z
z z p
d
d
d
dF