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
2.2 Second Order
2.3 Combine multiple filters
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
3.2 Second Order
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
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);
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);
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);
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;
11 Combine Filters
11.1 Additive
[ ]
Explain how phase and magnitude combine