using 3 filter back to back

2 visualizzazioni (ultimi 30 giorni)
Huijia Ma
Huijia Ma il 20 Nov 2021
Risposto: Saurav il 16 Feb 2024
how to use 3 R-C LPFs back to back each with a cut-off frequency of 450 Hz and a Twin-Tee circuit with a notch positioned at 800 Hz. to achieve this :
H = tf([1], [R*C1,1]) % is a low pass filter

Risposte (1)

Saurav
Saurav il 16 Feb 2024
Hey, Huijia Ma,
I understand that you want to achieve the filter response, using three RC low pass filters with a cut-off frequency of 450 Hz in a cascaded manner, along with a twin-tee notch filter centered at 800 Hz, as evident from the figure provided in the question.
Here is a possible solution:
  • You will need to create transfer functions for each and cascade them together to achieve the overall response.
  • To cascade three LPFs, you can raise the transfer function of one R-C LPF to the third power.
An example code for your reference is:
% Define the cutoff frequency for the LPF
fc = 450; % in Hz
% Define the notch frequency for the Twin-Tee notch filter
fc_notch = 800; % in Hz
% Choose a value for R, for example, 1 Ohm (for LPF),
% Change the value of R according to your circuit
R = 1; % in Ohms
% Calculate C based on chosen R and desired fc for LPF
C = 1 / (2 * pi * fc * R); % in Farads
% Define the transfer function for one LPF
H_lpf = tf([1], [R * C, 1]);
% Cascading three identical LPFs
H_lpf_cascaded = H_lpf^3;
% Assuming values for the Twin-Tee notch filter components
% Convert notch frequency to radians per second
omega_notch = 2 * pi * fc_notch;
% Example values for the damping ratio and notch frequency (for simplicity)
zeta = 0.1; % damping ratio (dimensionless)
% Define the transfer function for the Twin-Tee notch filter
H_notch = tf([1, 0, omega_notch^2], [1, 2 * zeta * omega_notch, omega_notch^2]);
% Cascading the LPF and notch filter
H_overall = H_lpf_cascaded * H_notch;
% Plot the PSD of the resultant signal
% Define the frequency range for plotting
f = logspace(0, 5, 10000); % Frequency range from 1 Hz to 100,000 Hz (10^5 Hz)
% Calculate the frequency response of the total transfer function
[mag, ~, w] = bode(H_overall, 2 * pi * f);
% Convert magnitude response to power (PSD is proportional to magnitude squared)
psd = squeeze(mag).^2;
% Plot the PSD
figure;
semilogx(f, 10*log10(psd));
grid on;
xlabel('Frequency [Hz]');
ylabel('PSD [dB]');
title('PSD of the filter response');
% Highlight the notch frequency
hold on;
line([fc_notch fc_notch], ylim, 'Color', 'red', 'LineStyle', '--');
text(fc_notch, 10*log10(psd(round(end/2))), ' Notch Frequency', 'Color', 'red', 'HorizontalAlignment', 'left');
hold off;
You can refer to the following documentation for more information on the functions “tf” , “bode” and “squeeze” respectively:
  1. https://www.mathworks.com/help/releases/R2022b/control/ref/tf.html
  2. https://www.mathworks.com/help/releases/R2022b/control/ref/lti.bode.html
  3. https://www.mathworks.com/help/releases/R2022b/matlab/ref/squeeze.html
I hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by