Update Content - 2023-10-13
This commit is contained in:
@@ -153,6 +153,61 @@ den = 1 + (2*Ts^2*wn^2 - 8) * z^-1 + (Ts^2*wn^2 - 4*Ts*wn*xi + 4) * z^-2
|
||||
And the transfer function is equal to `gain * num/den`.
|
||||
|
||||
|
||||
### Second Order Low Pass Filter {#second-order-low-pass-filter}
|
||||
|
||||
Let's consider a second order low pass filter:
|
||||
|
||||
\begin{equation}
|
||||
G(s) = \frac{g}{ms^2 + cs + k}
|
||||
\end{equation}
|
||||
|
||||
First the symbolic variables are declared (`Ts` is the sampling time, `s` the Laplace variable and `z` the "z-transform" variable).
|
||||
|
||||
```matlab
|
||||
%% Declaration of the symbolic variables
|
||||
syms Ts g m c k s z
|
||||
```
|
||||
|
||||
Then the bi-linear transformation is performed to go from continuous to discrete:
|
||||
|
||||
```matlab
|
||||
%% Bilinear Transform
|
||||
s = 2/Ts*(z - 1)/(z + 1);
|
||||
```
|
||||
|
||||
The symbolic formula of the notch filter is defined:
|
||||
|
||||
```matlab
|
||||
%% Second Order Low Pass Filter - Symbolic representation
|
||||
Ga = g/(m*s^2 + c*s + k)
|
||||
```
|
||||
|
||||
Finally, the numerator and denominator coefficients can be extracted:
|
||||
|
||||
```matlab
|
||||
%% Get numerator and denominator
|
||||
[N,D] = numden(Ga);
|
||||
|
||||
%% Extract coefficients (from z^0 to z^n)
|
||||
num = coeffs(N, z);
|
||||
den = coeffs(D, z);
|
||||
```
|
||||
|
||||
```text
|
||||
gain = 1/(4*m + 2*Ts*c + Ts^2*k)
|
||||
```
|
||||
|
||||
```text
|
||||
num = (Ts^2*g) + (2*Ts^2*g) * z^-1 + (Ts^2*g) * z^-2
|
||||
```
|
||||
|
||||
```text
|
||||
den = 1 + (2*Ts^2*k - 8*m) * z^-1 + (4*m - 2*Ts*c + Ts^2*k) * z^-2
|
||||
```
|
||||
|
||||
And the transfer function is equal to `gain * num/den`.
|
||||
|
||||
|
||||
### Second Order High Pass Filter {#second-order-high-pass-filter}
|
||||
|
||||
Let's consider a second order low pass filter:
|
||||
|
Reference in New Issue
Block a user