Bank of Linear Filters - Matlab
Table of ContentsClose
1 Low Pass
1.1 First Order Low Pass Filter
Parameters:
: cut-off frequency in [rad/s]
Characteristics:
- Low frequency gain of
- Roll-off equals to -20 dB/dec
Matlab code:
Copyw0 = 2*pi; % Cut-off Frequency [rad/s] H = 1/(1 + s/w0);
1.2 Second Order
Parameters:
: : Damping ratio
Characteristics:
- Low frequency gain: 1
- High frequency roll off: - 40 dB/dec
Matlab code:
Copyw0 = 2*pi; % Cut-off frequency [rad/s] xi = 0.3; % Damping Ratio H = 1/(1 + 2*xi/w0*s + s^2/w0^2);
1.3 Combine multiple first order filters
Matlab code:
Copyw0 = 2*pi; % Cut-off frequency [rad/s] n = 3; % Filter order H = (1/(1 + s/w0))^n;
2 High Pass
2.1 First Order
Parameters:
: cut-off frequency in [rad/s]
Characteristics:
- High frequency gain of
- Low frequency slow of +20 dB/dec
Matlab code:
Copyw0 = 2*pi; % Cut-off frequency [rad/s] H = (s/w0)/(1 + s/w0);
2.2 Second Order
Parameters:
: : Damping ratio
Matlab code:
Copyw0 = 2*pi; % [rad/s] xi = 0.3; H = (s^2/w0^2)/(1 + 2*xi/w0*s + s^2/w0^2);
2.3 Combine multiple filters
Matlab code:
Copyw0 = 2*pi; % [rad/s] n = 3; H = ((s/w0)/(1 + s/w0))^n;
3 Band Pass
3.1 Second Order
4 Notch
4.1 Second Order
Parameters:
: frequency of the notch : gain at the notch frequency : damping ratio (notch width)
Matlab code:
Copygc = 0.02; xi = 0.1; wn = 2*pi; H = (s^2 + 2*gm*xi*wn*s + wn^2)/(s^2 + 2*xi*wn*s + wn^2);
5 Chebyshev
5.1 Chebyshev Type I
Copyn = 4; % Order of the filter Rp = 3; % Maximum peak-to-peak ripple [dB] Wp = 2*pi; % passband-edge frequency [rad/s] [A,B,C,D] = cheby1(n, Rp, Wp, 'high', 's'); H = ss(A, B, C, D);
6 Lead - Lag
6.1 Lead
Parameters:
: frequency at which the phase lead is maximum : parameter to adjust the phase lead, also impacts the high frequency gain
Characteristics:
- the low frequency gain is
- the high frequency gain is
- the phase lead at
is equal to (Figure 10):
Matlab code:
Copya = 0.6; % Amount of phase lead / width of the phase lead / high frequency gain wc = 2*pi; % Frequency with the maximum phase lead [rad/s] H = (1 + s/(wc/sqrt(a)))/(1 + s/(wc*sqrt(a)));
6.2 Lag
Parameters:
: frequency at which the phase lag is maximum : parameter to adjust the phase lag, also impacts the low frequency gain
Characteristics:
- the low frequency gain is increased by a factor
- the high frequency gain is
(unchanged) - the phase lag at
is equal to (Figure 12):
Matlab code:
Copya = 0.6; % Amount of phase lag / width of the phase lag / high frequency gain wc = 2*pi; % Frequency with the maximum phase lag [rad/s] H = (wc*sqrt(a) + s)/(wc/sqrt(a) + s);
7 Complementary
8 Performance Weight
8.1 Nice combination
Copyn = 2; w0 = 2*pi*11; G0 = 1/10; G1 = 1000; Gc = 1/2; wL = Gc*(((G1/Gc)^(1/n)/w0*sqrt((1-(G0/Gc)^(2/n))/((G1/Gc)^(2/n)-1))*s + (G0/Gc)^(1/n))/(1/w0*sqrt((1-(G0/Gc)^(2/n))/((G1/Gc)^(2/n)-1))*s + 1))^n; n = 3; w0 = 2*pi*9; G0 = 10000; G1 = 0.1; Gc = 1/2; wH = Gc*(((G1/Gc)^(1/n)/w0*sqrt((1-(G0/Gc)^(2/n))/((G1/Gc)^(2/n)-1))*s + (G0/Gc)^(1/n))/(1/w0*sqrt((1-(G0/Gc)^(2/n))/((G1/Gc)^(2/n)-1))*s + 1))^n;
8.2 Alternative
Copyw0 = 2*pi; % [rad/s] A = 1e-2; M = 5; H = (s/sqrt(M) + w0)^2/(s + w0*sqrt(A))^2;
9 Combine Filters
9.1 Additive
[ ]
Explain how phase and magnitude combine
9.2 Multiplicative
10 Filters representing noise
Let’s consider a noise
The PSD
And the root mean square (RMS) of
10.1 First Order Low Pass Filter
Copyg0 = 1; % Noise Density in unit/sqrt(Hz) wc = 1; % Cut-Off frequency [rad/s] G = g0/(1 + s/wc); % Frequency vector [Hz] freqs = logspace(-3, 3, 1000); % PSD of n in [unit^2/Hz] Phi_n = abs(squeeze(freqresp(G, freqs, 'Hz'))).^2; % RMS value of n in [unit, rms] sigma_n = sqrt(trapz(freqs, Phi_n))
the Noise Density of in the bandwidth over which the noise is located, in rad/s the rms noise
If the cut-off frequency is to be expressed in Hz:
Thus, if a sensor is said to have a RMS noise of
Copy2*10e-9/sqrt(100)
2e-09
Copy6*0.5*20e-12*sqrt(2*pi*100)
1.504e-09