Experiment 4
Experimental Study of Analog Filters.
Objectives
The main objectives of this experiment are:
• To learn about different types of analog filters.
4.1 Theory
Analog filter is typically used in electronics and is considered as a basic building block of
signal processing.These analog filters are used to separate audio signals before applying to
loudspeakers. To separate and to combine several telephone conversations onto a single
channel can be done using analog filters. To select a particular radio station from the radio
receiver by rejecting all other channels can be done using analog filters.The continuously
varying signals (analog signals) can be operated using passive linear electronic analog filters
which are composed of passive elements such as resistors, capacitors, and inductors. These
analogue filters are frequently used for allowing particular frequency components by rejecting
other from analog or continuous time signals.
4.1.1 Types of Analog Filters
Low-pass Filter: A low-pass filter is an electronic circuit or signal processing component that
allows signals with frequencies lower than a certain cutoff frequency to pass through, while
attenuating or blocking signals with frequencies higher than the cutoff frequency. In essence,
a low-pass filter lets low-frequency signals "pass" through the filter while gradually attenuating
higher frequencies.The design and characteristics of a low-pass filter depend on factors such
as the type of filter (e.g., Butterworth, Chebyshev, or elliptic filters) and the desired cutoff
frequency. The cutoff frequency is the point at which the filter starts attenuating the
signal.Low-pass filters find applications in various areas, including audio processing,
communication systems, and control systems.
High-pass Filter: A high-pass filter is an electronic circuit or signal processing component
that allows signals with a frequency higher than a certain cutoff frequency to pass through
while attenuating or blocking signals with frequencies lower than the cutoff frequency. In
simpler terms, it lets high-frequency signals pass while reducing the amplitude of low-
frequency signals.The basic idea behind a high-pass filter is to create a frequency-dependent
response that attenuates lower frequencies and allows higher frequencies to pass through. High-
pass filters are commonly used in various applications, including audio processing,
telecommunications, and control systems.
Bandpass Filter: A bandpass filter is an electronic circuit or signal processing component that
allows signals within a certain frequency range, known as the passband, to pass through while
attenuating or blocking signals outside that range. In other words, a bandpass filter permits a
specific band of frequencies to pass through, while suppressing frequencies both below and
above the designated range.
1
The key parameters that define a bandpass filter include the center frequency (the midpoint of
the passband) and the bandwidth (the range of frequencies that are allowed to pass through).
Bandpass filters are commonly used in various applications, including audio processing, radio
frequency (RF) communication, and instrumentation.A bandpass filter has a response that
allows frequencies around the center frequency to pass through while attenuating frequencies
both above and below the passband. The shape of the filter response depends on the order and
type of the filter (e.g., Butterworth, Chebyshev, or elliptic).
Bandstop Filter: A bandstop filter, also known as a notch filter, is an electronic circuit or
signal processing component that attenuates or blocks a specific range of frequencies while
allowing frequencies outside that range to pass through. In other words, a bandstop filter creates
a "notch" or a dip in the frequency response, suppressing a certain band of frequencies.Key
features of a bandstop filter include the center frequency of the notch and the bandwidth of the
rejected frequencies. The center frequency is the point at which the filter exhibits maximum
attenuation, and the bandwidth is the range of frequencies around the center frequency that are
attenuated.A bandstop filter exhibits high attenuation at the center frequency (notch frequency),
creating a notch in the frequency response. Frequencies outside the notch are allowed to pass
with minimal attenuation.andstop filters are useful in scenarios where specific frequencies need
to be attenuated while allowing the rest of the signal to pass. They are part of the broader family
of filters, including low-pass, high-pass, and bandpass filters, each serving different purposes
in signal processing.
Low-pass High-pass
Band-pass Band-stop
Figure 4.1: Frequency response of different types of filters.
4.2 Required Apparatus
MATLAB Software.
2
4.3 Experimental Analysis
4.3.1 Lowpass and Highpass filter design.
Solution:
%lowpass filter %Highpass Filter
clc; clc;
clear all; clear all;
close all; close all;
fs=1000; fs=1000;
fc=50; fc=100;
f=10 f=10;
t=0:1/fs:1; t=0:1/fs:1;
filterorder=80; filterorder=2000;
b=fir1(filterorder,fc/(fs/2),'low'); b=fir1(filterorder,fc/(fs/2),'high');
signal=sin(2*pi*f*t); signal=sin(2*pi*f*t);
subplot(3,1,1) subplot(3,1,1)
plot(t,signal) plot(t,signal)
title('Input Signal') title('Input Signal')
noisysignal=signal+0.5*randn(size(t)); noisysignal=signal+0.5*randn(size(t));
subplot(3,1,2) subplot(3,1,2)
plot(t,noisysignal) plot(t,noisysignal)
title('Noisy Signal') title('Noisy Signal')
filteredsignal=filter(b,1,noisysignal); filteredsignal=filter(b,1,noisysignal);
subplot(3,1,3) subplot(3,1,3)
plot(t,filteredsignal) plot(t,filteredsignal)
title('Lowpass Signal') title('Highpass Signal')
Figure 4.2: Lowpass Signal.
3
Figure 4.3: Highpass Signal.
4.3.2 Bandpass and Bandstop filter design.
Solution:
%bandpass filter %bandstop filter
clc;clear all; clc;
close all; clear all;
fs=1000; close all;
f1=40;f2=60; fs = 1000;
filterOrder=100; f_notch = 175;
t=0:1/fs:1;f=10; bw = 20;
signal=sin(2*pi*f*t); filterorder = 64;
b=fir1(filterOrder,[f1/(fs/2),f2/(fs/2)],'band'); b = fir1(filterorder, [(f_notch - bw/2)/(fs/2),
noisysignal=signal+0.5*randn(size(t)); (f_notch + bw/2)/(fs/2)], 'stop');
filteredsignal=filter(b,1,noisysignal); t = 0:1/fs:1; f = 10;
subplot(3,1,1); signal = sin(2*pi*f*t);
plot(signal,'r'); noisysignal = signal + 0.5 * randn(size(t));
xlabel('time'); filtersignal = filter(b, 1, noisysignal);
ylabel('amplitude'); subplot(3,1,1);
title('Sinewave'); plot(t, signal,'k');
subplot(3,1,2); title('Input signal');
plot(noisysignal,'b'); subplot(3,1,2);
xlabel('time'); plot(t, noisysignal,'b');
ylabel('amplitude'); title('Signal + Noise') ;
title('Random Signal'); subplot(3,1,3) ;
subplot(3,1,3); plot(t, filtersignal,'b') ;
plot(filteredsignal,'b'); title('Filtered signal') ;
xlabel('time');
ylabel('amplitude');
title('Filtered Signal');
4
Figure 4.4: Bandpass Signal.
Figure 4.5: Band stop Signal.
4.4 Discussion and Conclusion
Through this experiment, we learned about different types of filters, such as lowpass,highpass,
bandpass, and bandstop filters. We also learned that a filter is an electrical circuit that rejects
frequencies outside of its pass range while passing through a predetermined range. We applied
a noisy signal to each of these filters to filter them using Matlab and got the desired output. We
observed that there is a huge impact of filter order on the filtering process. However, this
experiment has successfully finished, and the intended results were obtained.