0% found this document useful (0 votes)
64 views10 pages

Lab Work 6 - Frequency Response of Basic Filter Circuit

Uploaded by

Fikry Zahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views10 pages

Lab Work 6 - Frequency Response of Basic Filter Circuit

Uploaded by

Fikry Zahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

POLITEKNIK SULTAN SALAHUDDIN ABDUL AZIZ SHAH

ELECTRICAL ENGINEERING DEPARTMENT

DEE40113 SIGNAL AND SYSTEM

LECTURER DR. MARLINA BINTI RAMLI

TYPE OF ASSESSMENT PRACTICAL WORK 6


FREQUENCY RESPONSE OF BASIC
TOPIC
FILTER CIRCUIT
DURATION 2 HOURS

DATE OF ASSESSMENT

NAME REGISTRATION NO.

MUHAMMAD ZIDAN
HELMI BIN 08DEP22F1138
AMMINUDDIN
INDIVIDUAL/
ADAM DARWISY BIN
GROUP MEMBERS 08DEP22F1106
MOHD

MARKS /100
DEE40113 SIGNAL AND SYSTEM
PRACTICAL WORK 6 – Frequency Response of Basic Filter Circuit
manipulate software to analyze the DK 6 -Codified practical engineering
CLO2 signals and systems correctly based PLO5 knowledge in a recognized practice
on the given procedure (P4, PLO5) area

A. OBJECTIVE/EXPERIMENT OUTCOMES

1. To write the program to generate a basic signal.


2. To execute the program to interpret and carry out the instructions.
3. To debug the program to identify and fix errors or bugs.
4. To display the output in the specified format.

B. THEORY

The Fourier filter is a type of filtering function that is based on the manipulation of
specific frequency components of a signal. It works by taking the Fourier transform of the signal,
then attenuating or amplifying specific frequencies, and finally inverse-transforming the result. In
many science measurements, such as spectroscopy and chromatography, the signals are relatively
smooth shapes that can be represented by a surprisingly small number of Fourier components. For
example, the figure below (script) shows in the top panel a signal of three smooth peaks, with
peak heights of 1, 2, and 3, where the x-axis is time in seconds. The middle panel shows the first
51 frequencies of its Fourier spectrum (zero through 50). In this case, the x-axis is both the
frequency in Hz and the Fourier component number (because the duration of the signal is exactly
1 second). The amplitude of the Fourier components is strongest at low frequencies and drops to
near zero at 25 Hz.
The simplest possible code for an elementary Fourier filer can be most simply illustrated by
a low-pass sharp cut-off filter. Care must be taken to use both the real and imaginary (or
equivalently the frequency and phase of the sine and cosine) components of the Fourier
transform. The operation must account for the mirror-image structure of Matlab's Fourier
transform: the lowest frequencies are at the extremes of the FFT and the highest frequencies are in
the center portion. To pass the lowest n frequencies, pass the first n points and the last n points
and zero out the others.

ffty=fft(y); % ffty is the fft of y


lfft=length(ffty); % Length of the FFT
% All frequencies between n and lfft-n in the fft
% are set to zero.
ffty(n:lfft-n)=0;
fy=real(ifft(ffty)); % Real part of the inverse fft

Here, n is the number of frequencies that are passed; all others are simply eliminated. The
function form of this operation is flp.m. This is the minimal essence of a Fourier filter. The
script flptest.m demonstrates its use (figure on the right). The is not a practical filter, however,
because its abrupt cutoff usually results in ringing on the baseline, as shown below.
C. TOOLS/APPARATUS/EQUIPMENT
Computer, Software MATLAB, Scilab, Octave Online etc

D. SAFETY PROCEDURE
1. Do not plug in external devices (e.g USB thumb drive) without scanning them for computer
viruses.
2. Always back up all your important data files.

E. PROCEDURE

TASK A : DISPLAYS IIR FILTERS (LOW PASS)

Execute the following command arrays below.

clear, close all


clc
load('filterExample.mat', 'Fs', 't', 'x', 'x_noisy');

% Design a 6th-order (n) lowpass filter with a cutoff frequency (fc) of


% 50 Hz, which, for data sampled at Fs Hz, corresponds to fc/(Fs/2) ?
rad/sample.
% Plot its magnitude and phase responses. Use it to filter the noisy
signal
% from previous example.
% settings for lowpass filter (general)
fc = 50; % cutoff frequency
n = 6; % filter order

% filter-specific parameters
pbr = 10; % chebyshev 1 / elliptic passband ripple (dB)
sba = 40; % chebyshev 2 / elliptic stopband attenuation (dB);

% filter options
% [b,a] = butter(n, fc/(Fs/2)); % Butterworth. fc/(Fs/2) converts
the unit rad/sample
% [b,a] = cheby1(n, pbr, fc/(Fs/2)); % Chebyshev I Filter
% [b,a] = cheby2(n,sba,fc/(Fs/2)); % Chebyshev II Filter
[b,a] = ellip(n,pbr,sba,fc/(Fs/2)); % Elliptic Filter

% show the frequency response of the signal


figure, freqz(b,a);

% apply the filter to the noisy data


x_cleaned = filter(b,a,x_noisy);

% output in time domain


figure, subplot(211);
plot(t,x_noisy);
hold on, plot(t, x_cleaned,'r');
legend('Original','Filtered');
xlabel('Time (t)');
ylabel('x(t)');

% output in frequency domain


n = 2^nextpow2(length(x_noisy));
Ynoisy = fft(x_noisy,n);
Ycleaned = fft(x_cleaned,n);

f = Fs*(0:(n/2))/n;
Pnoisy = abs(Ynoisy/n);
Pcleaned = abs(Ycleaned/n);
% plot the signal in frequency domain
subplot(212), plot(f,Pnoisy(1:n/2+1)) ;
hold on, plot(f,Pcleaned(1:n/2+1)) ;
title('Frequency Domain');
xlabel('Frequency (Hz)');
ylabel('x(t)');
legend('Original','Filtered');

TASK B : DISPLAYS IIR FILTERS (HIGH PASS)

Execute the following command arrays below.

clear, close all


clc
load('filterExample.mat', 'Fs', 't', 'x', 'x_noisy');

% Display a 6th-order (n) highpass filter with a cutoff frequency


(fc) of
% 50 Hz, which, for data sampled at Fs Hz, corresponds to
fc/(Fs/2) ? rad/sample.
% Plot its magnitude and phase responses. Use it to filter the
noisy signal
% from previous example.

% settings for lowpass filter (general)


fc = 50; % cutoff frequency
n = 6; % filter order

% filter-specific parameters
pbr = 10; % chebyshev 1 / elliptic passband ripple (dB)
sba = 40; % chebyshev 2 / elliptic stopband attenuation (dB);

% filter options
%[b,a] = butter(n, fc/(Fs/2), 'high'); % Butterworth.
fc/(Fs/2) converts the unit rad/sample
%[b,a] = cheby1(n, pbr, fc/(Fs/2), 'high'); % Chebyshev I Filter
%[b,a] = cheby2(n,sba,fc/(Fs/2), 'high'); % Chebyshev II Filter
[b,a] = ellip(n,pbr,sba,fc/(Fs/2), 'high'); % Elliptic
Filter

% show the frequency response of the signal


figure, freqz(b,a);

% apply the filter to the noisy data


x_cleaned = filter(b,a,x_noisy);

% output in time domain


figure, subplot(211);
plot(t,x_noisy);
hold on, plot(t, x_cleaned,'r');
legend('Original','Filtered');
xlabel('Time (t)');
ylabel('x(t)');

% output in frequency domain


n = 2^nextpow2(length(x_noisy));
Ynoisy = fft(x_noisy,n);
Ycleaned = fft(x_cleaned,n);
f = Fs*(0:(n/2))/n;
Pnoisy = abs(Ynoisy/n);
Pcleaned = abs(Ycleaned/n);

% plot the signal in frequency domain


subplot(212), plot(f,Pnoisy(1:n/2+1)) ;
hold on, plot(f,Pcleaned(1:n/2+1)) ;
title('Frequency Domain');
xlabel('Frequency (Hz)');
ylabel('x(t)');
legend('Original','Filtered');

F. RESULT/DATA
TASK A : DISPLAYS IIR FILTERS (LOW PASS)
Execute the following command arrays below.

% Display a 6th-order (n) lowpass filter with a cutoff frequency (fc) of


% 50 Hz, which, for data sampled at Fs Hz, corresponds to fc/(Fs/2) ? rad/sample.
% Plot its magnitude and phase responses. Use it to filter the noisy signal
% from previous example.
% settings for lowpass filter (general)

% filter-specific parameters

% filter options
% [b,a] = butter(n, fc/(Fs/2)); % Butterworth. fc/(Fs/2) converts
the unit rad/sample
% [b,a] = cheby1(n, pbr, fc/(Fs/2)); % Chebyshev I Filter
% [b,a] = cheby2(n,sba,fc/(Fs/2)); % Chebyshev
II Filter [b,a] = ellip(n,pbr,sba,fc/(Fs/2)); %
Elliptic Filter

% show the frequency response of the signal


% apply the filter to the noisy data
% output in time domain
% output in frequency domain
% plot the signal in frequency domain

TASK B : DISPLAYS IIR FILTERS (HIGH PASS)


Execute the following command arrays below.

% Design a 6th-order (n) highpass filter with a cutoff frequency (fc) of


% 50 Hz, which, for data sampled at Fs Hz, corresponds to fc/(Fs/2) ? rad/sample.
% Plot its magnitude and phase responses. Use it to filter the noisy signal
% from previous example.

% settings for lowpass filter (general)

% filter-specific parameters
% filter options
% show the frequency response of the signal
% apply the filter to the noisy data
% output in time domain
% output in frequency domain
% plot the signal in frequency domain

G. DISCUSSION

The frequency response of a basic filter circuit plays a fundamental role in signal processing, as it
determines how the circuit affects the amplitude and phase of different frequencies within an input
signal. Filters are designed to allow certain frequencies to pass through unaltered while attenuating
others, enabling the manipulation of signals for specific applications. The most common types of
filters—low-pass, high-pass, band-pass, and band-stop—each have unique frequency responses that
cater to different needs. A low-pass filter, for instance, permits lower frequencies to pass while
attenuating frequencies above a certain cutoff point, making it ideal for removing high-frequency
noise in audio systems. Conversely, a high-pass filter allows high frequencies to pass and attenuates
frequencies below a cutoff, commonly used to eliminate low-frequency hum or background noise.
Band-pass filters allow a range of frequencies between a lower and upper cutoff to pass, blocking
frequencies outside of this range, and are valuable in applications like radio receivers, where
specific frequency bands need to be isolated. Band-stop filters, or notch filters, work inversely,
blocking a particular frequency range while allowing frequencies outside that range to pass, often
used to eliminate unwanted frequencies such as power line hum.

The performance and effectiveness of these filters are often characterized by certain parameters,
including the cutoff frequency, roll-off rate, and in the case of band-pass and band-stop filters,
bandwidth. The cutoff frequency marks the point at which the output begins to attenuate, typically
by 3 dB, which corresponds to about 70.7% of the original signal amplitude. The rate of attenuation,
or roll-off, is also a crucial attribute; it defines how sharply the filter suppresses frequencies outside
the passband. A steeper roll-off results in a more selective filter, which can be achieved by
increasing the filter’s order, or the number of reactive components (like capacitors or inductors) in
the circuit. Phase response is another important factor, as some filters can shift the phase of
different frequency components, which might be undesirable in applications requiring signal
coherence, such as data communications.

Overall, the frequency response of basic filter circuits enables precise control over the spectral
content of signals, making them essential tools in applications ranging from audio processing and
communications to instrumentation and control systems. Filters help eliminate noise, isolate desired
signal components, and refine signals for further processing. The flexibility in filter design allows
engineers to create circuits that meet the specific demands of various applications, whether it’s
enhancing audio clarity, protecting sensitive equipment from interference, or isolating frequency
bands for transmission and reception. The predictable behavior of filters based on their frequency
response provides a solid foundation for reliable signal manipulation in both analog and digital
systems.

H. CONCLUSION
In conclusion, the frequency response of a basic filter circuit is crucial in
controlling which parts of a signal are emphasized or suppressed, enabling
selective frequency manipulation. Low-pass filters attenuate high frequencies,
high-pass filters reduce low frequencies, and band-pass filters isolate a
specific frequency range. These characteristics make filters indispensable in
applications like noise reduction, signal processing, and communication systems,
where managing frequency content is essential for achieving desired outcomes.

I. REFERENCES

1. J. Santiago, "How to Describe the Frequency Response of Filter Circuits,"


Dummies, Updated: 03-26-2016. [Online]. Available:
https://www.dummies.com/article/technology/electronics/circuitry/how-to-
describe-the- frequency-response-of-filter-circuits-166513/.

2. MathWorks, "IIR Filter Design," MathWorks,


[Online]. Available:
https://www.mathworks.com/help/signal/ug/iir-filter-
design.html.

3. MathWorks, "Fourier Transforms," MathWorks, [Online].


Available:
https://www.mathworks.com/help/matlab/math/fourier-
transforms.html.

4. R. Baraniuk et al., "Continuous Time Fourier Transform (CTFT)," Rice


University, [Online]. Available:
https://eng.libretexts.org/Bookshelves/Electrical_Engineering/Signal_Processing
_and_
Modeling/Signals_and_Systems_(Baraniuk_et_al.)/08%3A_Continuous_Time_F
ourier_
Transform_(CTFT)/8.02%3A_Continuous_Time_Fourier_Transform_(CTFT).

5. M. K. Saini, "Fourier Transform of the Sine and Cosine Functions,"


Tutorialspoint, Updated on: 09-Dec-2021. [Online]. Available:
https://www.tutorialspoint.com/fourier- transform-of-the-sine-and-cosine-
functions.

Prepared by : Checked by : Verified by :

(DR. MARLINA RAMLI) (ABU BAKAR HAFIS BIN (NORAZLINA BINTI JAAFAR)
KAHAR) Head of Department/Head of
Course Coordinator/Course Head of Programme/Subject Matter Programme/ Course Leader
Lecturer Expert/Course Coordinator
Date : 2.8.2024
Date : 2.8.2024
Date : 2.8.2024

You might also like