UP | HOME

List of filters - Matlab Implementation

Table of Contents

1 Proportional - Integral - Derivative

1.1 Proportional

1.2 Integral

1.3 Derivative

2 Low Pass

2.1 First Order

\[ H(s) = \frac{1}{1 + s/\omega_0} \]

w0 = 2*pi; % [rad/s]

H = 1/(1 + s/w0);

lpf_first_order.png

Figure 1: First Order Low Pass Filter (png, pdf.

2.2 Second Order

\[ H(s) = \frac{1}{1 + 2 \xi / \omega_0 s + s^2/\omega_0^2} \]

w0 = 2*pi; % [rad/s]
xi = 0.3;

H = 1/(1 + 2*xi/w0*s + s^2/w0^2);

lpf_second_order.png

Figure 2: Second Order Low Pass Filter (png, pdf.

2.3 Combine multiple filters

\[ H(s) = \left( \frac{1}{1 + s/\omega_0} \right)^n \]

w0 = 2*pi; % [rad/s]
n = 3;

H = (1/(1 + s/w0))^n;

lpf_multiple_first_order.png

Figure 3: Combine Multiple First Order Low Pass Filter (png, pdf.

2.4 Nice combination

\begin{equation} W(s) = G_c * \left(\frac{\frac{1}{\omega_0}\sqrt{\frac{1 - \left(\frac{G_0}{G_c}\right)^{\frac{2}{n}}}{1 - \left(\frac{G_c}{G_\infty}\right)^{\frac{2}{n}}}} s + \left(\frac{G_0}{G_c}\right)^{\frac{1}{n}}}{\frac{1}{\omega_0} \sqrt{\frac{1 - \left(\frac{G_0}{G_c}\right)^{\frac{2}{n}}}{\left(\frac{G_\infty}{G_c}\right)^{\frac{2}{n}} - 1}} s + 1}\right)^n \end{equation}
n = 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;

3 High Pass

3.1 First Order

\[ H(s) = \frac{s/\omega_0}{1 + s/\omega_0} \]

w0 = 2*pi; % [rad/s]

H = (s/w0)/(1 + s/w0);

hpf_first_order.png

Figure 4: First Order High Pass Filter (png, pdf.

3.2 Second Order

\[ H(s) = \frac{s^2/\omega_0^2}{1 + 2 \xi / \omega_0 s + s^2/\omega_0^2} \]

w0 = 2*pi; % [rad/s]
xi = 0.3;

H = (s^2/w0^2)/(1 + 2*xi/w0*s + s^2/w0^2);

hpf_second_order.png

Figure 5: Second Order High Pass Filter (png, pdf.

3.3 Combine multiple filters

\[ H(s) = \left( \frac{s/\omega_0}{1 + s/\omega_0} \right)^n \]

w0 = 2*pi; % [rad/s]
n = 3;

H = ((s/w0)/(1 + s/w0))^n;

hpf_multiple_first_order.png

Figure 6: Combine Multiple First Order High Pass Filter (png, pdf.

4 Band Pass

5 Notch

6 Bump

n = 4;
w0 = 2*pi;
A = 10;

a = sqrt(2*A^(2/n) - 1 + 2*A^(1/n)*sqrt(A^(2/n) - 1));
G = ((1 + s/(w0/a))*(1 + s/(w0*a))/(1 + s/w0)^2)^n;
bodeFig({G})

7 Chebyshev

7.1 Chebyshev Type I

n = 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);

cheby1_hpf.png

Figure 7: First Order Low Pass Filter (png, pdf.

8 Lead - Lag

8.1 Lead

\[ H(s) = \frac{1 + s/\omega_z}{1 + s/\omega_p}, \quad \omega_z < \omega_p \]

  • [ ] Find a nice parametrisation to be able to specify the center frequency and the phase added
  • [ ] Compute also the change in magnitude
h = 2.0;
wz = 2*pi/h; % [rad/s]
wp = 2*pi*h; % [rad/s]

H = (1 + s/wz)/(1 + s/wp);

lead_filter.png

Figure 8: Lead Filter (png, pdf.

8.2 Lag

\[ H(s) = \frac{1 + s/\omega_z}{1 + s/\omega_p}, \quad \omega_z > \omega_p \]

  • [ ] Find a nice parametrisation to be able to specify the center frequency and the phase added
  • [ ] Compute also the change in magnitude
h = 2.0;
wz = 2*pi*h; % [rad/s]
wp = 2*pi/h; % [rad/s]

H = (1 + s/wz)/(1 + s/wp);

lag_filter.png

Figure 9: Lag Filter (png, pdf.

8.3 Lead Lag

\[ H(s) = \frac{1 + s/\omega_z}{1 + s/\omega_p} \frac{1 + s/\omega_z}{1 + s/\omega_p}, \quad \omega_z > \omega_p \]

wz1 = 2*pi*1; % [rad/s]
wp1 = 2*pi*0.1; % [rad/s]
wz2 = 2*pi*10; % [rad/s]
wp2 = 2*pi*20; % [rad/s]

H = (1 + s/wz1)/(1 + s/wp1)*(1 + s/wz2)/(1 + s/wp2);

lead_lag_filter.png

Figure 10: Lead Lag Filter (png, pdf.

9 Complementary

10 Performance Weight

w0 = 2*pi; % [rad/s]
A = 1e-2;
M = 5;

H = (s/sqrt(M) + w0)^2/(s + w0*sqrt(A))^2;

weight_first_order.png

11 Combine Filters

11.1 Additive

  • [ ] Explain how phase and magnitude combine

11.2 Multiplicative

Author: Dehaeze Thomas

Created: 2019-10-08 mar. 13:27

Validate