NEE3208 Signal Processing: FIR Filter Design for Noise Removal Report

Verified

Added on  2023/05/28

|18
|3101
|78
Report
AI Summary
This report details the design and implementation of a Finite Impulse Response (FIR) low pass filter in MATLAB to remove white noise from a signal. The assignment involves designing the kernel filter h(n) by defining its impulse response and using three different kernels, evaluating the transfer function using the Discrete Fourier Transform (DFT), plotting the magnitude of the transfer functions, applying the filter in the frequency domain, and obtaining the Inverse DFT to get the filtered signal y(n). The report discusses the windowing method, specifically the Kaiser window, and analyzes the main lobe, side lobe, and peak values. Different kernels are analyzed, and filters are applied in both the frequency and time domains to obtain filtered signals, with a focus on achieving an ideal low pass filter response for reducing white noise while considering the trade-offs between filter order, complexity, and ripple behavior. Desklib provides access to this and other solved assignments for students.
tabler-icon-diamond-filled.svg

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
STUDENT NAME
STUDENT ID NUMBER
INSTITUTIONAL AFFILIATION
LOCATION
DATE OF SUBMISSION
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
ASSIGNMENT 3
INTRODUCTION
Signals are obtained from the physical systems based on voltage values over a given time frame.
Disturbances and noise may affect the signal obtained. These disturbances are experienced from
the effects of the surroundings as well as the processing units [1]-[5]. Filters are used to attenuate
a selected range of frequencies from the continuous time signal. The design of filters is quite
crucial especially when the analog signal is under analysis so as to preserve as much of the
original signal as is possible. There are different types of filters within the transfer function with
a bandwidth of,
H ( f ) =|H ( f )|e ( f )
A designer is able to choose between the digital filter and the analog filter. A digital filter
has a very high accuracy, linear phase, no drift, easy to simulate and design, computation must
be completed within sampling period, and there is need for high speed ADC and DAC. On the
other hand, the analog filter is considered to be a bit less accurate as a result of the nonlinear
phase and the drift is as a result of the components [6]. The filter is difficult to simulate and
design as well as the limited by the op-amp or transistor gain bandwidth. Its design does not
require digital ICs. To determine the impulse response of the ideal low pass filter given the
signal is in frequency domain.
Document Page
h ( t ) =I { H ( f ) }
¿


H ( f ) e j 2 πft df
¿
fu
fu
e j 2 πf t0
e j 2 πft df
¿


e j 2 πf (t t0) df
¿ 2 f u
sin2 π f u ( tt0 )
2 π f u ( tt0 )
Further, when performing impulse response on a signal, the FIR and IIR filters are used. The
finite impulse response, FIR, can be computed faster using the linear phase. There is no feedback
loop involved in the filter as it only has a feed-forward only architecture. Some of the items to
consider for the design are the windowing, the equirriple design is required as well as the
frequency selection. The filter uses the weighted least squares as well as the parks-Mcclellan
method to design the filter [7]. On the other hand, the infinite impulse response presents a slower
response when connecting to the feedback path, with a non-linear phase as well as it has a
feedback loop that is used to control the filter characteristics. The IIR filters focus on the bilinear
transformation and the impulse invariant are used to develop the design of an IIR filter. The FIR
filter is of the form,
y ( n )=
i=0
M1
h ( i ) x ( ni )
The transfer function is given as,
Document Page
H ( z ) = Y ( z )
X ( z ) =

k=0
M
bk zk
1+
k=1
N
ak zk
For the fir filter, there is no feedback. The length is given as order M,
y ( n )=
k=0
M1
bk x ( nk )=
k=0
M 1
h ( k ) x ( nk )
To determine the exact linear phase response of the fir filter, to determine the impulse response
of the ideal low pass filter,
h ( t )=I {H ( f ) }
¿


H ( f ) e j 2 πft df
¿
fu
fu
e j 2 πf t0
e j 2 πft df
¿


e j 2 πf (t t0) df
¿ 2 f u
sin2 π f u ( tt0 )
2 π f u ( tt0 )
The low pass filter allows the low frequency components of a signal given below for the cutoff
frequency and denies all other frequency components above the cut off frequency. The filter
satisfies
H LP ( e jw ) = { 10 ω ωc
0 , ωc ω π
The impulse response of the ideal low pass filter is given as,
hLP [n]= sin ( ωc n )
πn
Windowing
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Digital filters
The digital filters are not easy to realize and the impulse responses may take a long time
to become non-causal. The amplitude response is obtained from the digital filters and it is not
equal to the constant over a band of frequencies. When designing the FIR, it is important to
consider that the FIR may not be infinite at any section. There are a number of filter responses
obtained using different topologies and the designs depend on the application needed from the
simple frequency cutoff to controlling the behavior for the low pass filter and the band pass
filter. For the FIR digital filter design uses the following approaches for the FIR filter design,
(i) Windowed Fourier series approach
(ii) Frequency sampling approach
(iii) Computer based optimization methods
The transfer function is given as,
H ( z )=
n=0
N 1
h ( n ) zn
The length of the impulse response is given as N and all the poles are obtained about z=0. It is
allowed to place the zeros at any point on the z-plane.
ln( H ( z ))=ln( K )+
i=1
n1
ln ( 1α i z1 )+
i=1
n2
ln (1βi z1 )
N2( z )=
i=1
n2
(1 βi z1 )
N1( z )=
i =1
n1
(1 αi z1 )
Document Page
The non-recursive form of the finite impulse response is given as,
y ( n )=h ( 0 ) x ( n ) +h ( 1 ) x ( n1 )+ +h ( N ) x ( nN )
where N is the order of the filter.
The filter is stable and it provides for the linear phase although when there are many coefficients
are not good for the system or filter performance. The filter impulse response has a finite
duration given such that,
Using the discrete Fourier Transform function on MATLAB to find the transfer function, the
window size is obtained as given in the different kernels. The smoother the window, the peak
side lobes are observed to decrease while the main lobe width increases. There is no need to
increase the window length so as to achieve the same transition bandwidth. The following
illustration demonstrates the low pass FIR filter using window design method,
Document Page
Based on the standards from the published data using a window function,
LAB EXERCISE
PART 1
Designing the kernel filter h(n) for the impulse response.
The design of the FIR filter can be expanded using the Fourier series such that,
h ( e )=
n=

h ( n ) e jwn
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
& such that,
h ( n ) = 1
2 π
π
π
H (e ) e jωn
The filter impulse response follows a weighting sequence called a window such that uses the
Fourier Coefficients , h(n), to control the convergence of the series.
^h ( e ) = 1
2 π
π
π
H ( e ) e j ( ωθ )
Using the windowing design the low pass filter is given as,
Hd ( ω )= { 1 ,if |ωc| ωc
0 , if ωC <|ωc|< π
The kernel impulse response is obtained as,
hd ( n )= ωc
π
sin ωc n
ωc n
A spectrum convolution is obtained,
H ( ω ) = 1
2 π
π
π
H d ( λ ) W ( ωλ ) .. spectrum convolution
It uses the periodic continuous convolution to determine the frequency response based on the
window of the Fourier Transform. Using the Kaiser window,
Document Page
Implementing the solution on MATLAB,
For Kernel 1,
%% PART I
windowsize=5;
b=(1/windowsize)*ones(1,windowsize);
a=4;
figure(3)
y=filter(b,a,assign2);
plot(t,assign2)
hold on
plot(t,y)
legend('Input Data','Filtered Data')
grid on
0 5 10 15
105
-20000
-15000
-10000
-5000
0
5000
Input Data
Filtered Data
For kernel 2,
windowsize=3;
b=(1/windowsize)*ones(1,windowsize);
a=4;
figure(3)
y=filter(b,a,assign2);
plot(t,assign2)
hold on
plot(t,y)
legend('Input Data','Filtered Data')
grid on
Document Page
0 5 10 15
105
-20000
-15000
-10000
-5000
0
5000
Input Data
Filtered Data
For kernel 3,
windowsize=7;
b=(1/windowsize)*ones(1,windowsize);
a=4;
figure(3)
y=filter(b,a,assign2);
plot(t,assign2)
hold on
plot(t,y)
legend('Input Data','Filtered Data')
grid on
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
0 5 10 15
105
-20000
-15000
-10000
-5000
0
5000
Input Data
Filtered Data
Using the absolute data version of the assign2.mat values
0 5 10 15
105
0
2000
4000
6000
8000
10000
12000
14000
16000
Document Page
PART II
To evaluate the transfer function using the DFT,
%% PART II
figure(6)
h=fft(y);
t2=1:length(h);
plot(t2,h);
grid on
hold on
h2=fft(y1);
t2=1:length(h2);
plot(t2,h2);
hold on
h3=fft(y2);
t2=1:length(h3);
plot(t2,h3);
grid on
legend('window size=7','window size=3','window size=2')
0 5 10 15
105
-1
0
1
2
3
4
5
6 107
window size=7
window size=3
window size=2
Document Page
PART III
Applying a filter on the frequency domain on the function obtained using the inverse discrete
Fourier transform of the filtered signal.
lpFilt = designfilt('lowpassfir', 'PassbandFrequency', 0.25,...
'StopbandFrequency', 0.35, 'PassbandRipple', 0.5, ...
'StopbandAttenuation', 65, 'DesignMethod', 'kaiserwin');
qw= filter(lpFilt,gh); % apply filter to your data
ds=ifft(qw); %To obtain the inverse fast fourier transform
figure(7)
td=1:length(ds);
plot(td,ds)
grid on
Determining the cut-off frequency,
f c=0.25 π Hz
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
PART IV
Each kernel is analyzed, and a filter is applied in the time domain to obtain the filtered signal
y(n),
%Applying a filter on the time domain
lpFilt = designfilt('lowpassfir', 'PassbandFrequency', 0.25,...
'StopbandFrequency', 0.35, 'PassbandRipple', 0.5, ...
'StopbandAttenuation', 65, 'DesignMethod', 'kaiserwin');
qw1= filter(lpFilt,y); % apply filter to your data
qw2=filter(lpFilt,y1); % apply filter to your data
qw3=filter(lpFilt,y2); % apply filter to your data
figure(8)
subplot(3,1,1)
tda=1:length(qw1);
plot(tda,qw1,'r-.')
grid on
legend('Kernel=1')
subplot(3,1,2)
plot(tda,qw2,'g-.')
grid on
legend('Kernel=2')
subplot(3,1,3)
plot(tda,qw3,'b-.')
hold off
grid on
legend('Kernel=3')
Document Page
DISCUSSION
A suitable window function was chosen based on table one as discussed in the introduction. The
most suitable windowing strategy opted for many FIR filters is the Kaiser window. The main
lobe, side lobe and peak values were determined [8]. The system determined a system filter and
devised a suitable filter response. It is required that the windowing choice be aligned to the low
pass filter. For an ideal low pass filter with an aim of reducing the white noise from the message.
The following frequency response is used for the analysis,
Hd ( ω )= { 1 ,if |ωc| 0.25 π
0 , if 0.25 π <|ωc|< π
The coefficients of the filter were chosen based on the frequency response using the inverse
discrete time Fourier transform of the frequency response defined above. The function that
performs the inverse discrete time Fourier transform (IDFT) given such as,
hd ( n ) = ωc
π
sin ωc n
ωc n
Document Page
The filter frequency response is found to land exactly on the specified values based on
the sampling points although it is quite difficult to control the points as they are sinc-
interpolated. It is important to know that the FIR filter design based on the window design is
simple and quite stable although its performance can be improved [9]. The output has some
ripples on the ends such that the decays move away from the discontinuity points based on the
side-lobe pattern of the window. To determine the freedom in the ripple behavior, it is possible to
reduce the filter order and determine the complexity. The output demonstrates the desired
frequency response based on the filter of the linear phase FIR amplitude function. The function
obtains the optimality of the criterion. There are various techniques generated for designing of
FIR filters [10].
Every method has its own merits and demerit. For example, design linear phase FIR
filters by a novel weighted BP neural networks algorithm has some limitation it is not involved
in operation of inverse matrix and the window method is also have some limitations like they are
not very suitable for designing of filters with any given frequency response. The future work is
develop a technique suitable for designing of filters with a given magnitude response and reduce
the noise of signal [11].
CONCLUSION
In a nutshell, the experiment finds the low pass filter design using FIR filter for the
message received and stored as assign2.mat file. When designing the FIR, it is important to
consider that the FIR may not be infinite at any section. There are a number of filter responses
obtained using different topologies and the designs depend on the application needed from the
simple frequency cutoff to controlling the behavior for the low pass filter and the band pass
filter.
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
REFERENCES
[1].Lutovac, M.D. and Tošić, D.V. SchematicSolver Symbolic Signal Processing, Version
2.2, Miroslav Lutovac, Belgrade, Serbia(2010).
[2].Lutovac, M.D., Tošić, D.V. and Evans, B.L Filter Design for Signal Processing Using
MATLAB and Mathematica,Prentice Hall, New Jersey, USA. . (2000)
[3].Milic, LMultirate Filtering for Digital Signal Processing: MATLAB Applications,
Information Science Reference, Hershey NY. (2009).
[4].Mladenović, V., Lutovac, M. and Lutovac, M ‘Automated proving properties of
expectation-maximization algorithm using symbolic tools’, Telfor Journal, Vol. 4, No. 1
pp.54–59, . (2012).
[5].Pavlović, V.D., Lutovac, M.M. and Lutovac, M.D. ‘Automated knowledge-based filter
synthesis using modified Legendre approximation and optimization of summed
sensitivity’, International Journal of Reasoning-based Intelligent Systems, Vol. 4, Nos.
1/2, pp.17–27, (2012).
[6].Schüssler, H.W. and Steffen, P. ‘Recursive half-band filters’, AEÜ-Archiv fur Elektronik
und Übertragungstechnik,Vol. 55, No. 6, pp.377–388. (2001).
[7].Sheikh, Z.U. and Johansson, H. ‘Wideband linear-phase FIR differentiators utilizing
multirate and frequency-response masking techniques’, Proceedings of IEEE
International Symposium Circuits and System (ISCAS’09), pp.293–296. (2009).
[8].Sheikh, Z.U. and Johansson, H. ‘A class of wide-band linearphase FIR differentiators
using a two-rate approach and the frequency-response masking techniques’, IEEE
Transactions On Circuits and Systems – Regular Papers, Vo. 58, pp.1827–1839, (2011).
[9].Signal Processing Toolbox. ‘Signal Processing Toolbox for Use with MATLAB’, User’s
Guide, The MathWorks Inc.,3 Apple Hill Drive, Natic, MA, (2006).
Document Page
[10]. Tanaka, T. ‘Circuit grammar: knowledge representation for structure and function
of electronic circuits’, International Journal of Reasoning-based Intelligent Systems, Vol.
1, Nos. 1/2, pp.56–67, (2009).
[11]. Tanaka, T. ‘Deriving electrical dependencies from circuit topologies using logic
grammar’, International Journal of Reasoning-based Intelligent Systems, Vol. 3, No. 1,
pp.28–33, (2011).
chevron_up_icon
1 out of 18
circle_padding
hide_on_mobile
zoom_out_icon
logo.png

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]