International University School of Computer Science & Engineering VIETNAM NATIONAL UNIVERSITY - HO CHI MINH CITY INTERNATIONAL UNIVERSITY SCHOOL OF COMPUTER SCIENCE AND ENGINNERING... In
Trang 1International University School of Computer Science & Engineering
VIETNAM NATIONAL UNIVERSITY - HO CHI MINH CITY
INTERNATIONAL UNIVERSITY SCHOOL OF COMPUTER SCIENCE AND ENGINNERING
Digital Signal Processing Laboratory
TRANSFER FUNCTION AND DIGITAL
FILTER DESIGN
Submitted by
Date Submitted:
Date Performed:
Lab Section:
Course Instructor:
Trang 2GRADING GUIDELINE FOR LAB REPORT
Number | Content Score | Comment
1 Format (max 9%)
- Font type Yes No
- Font size Yes No
- Table of contents Yes No
- Header/Footer Yes No
- List of figures (if exists) Yes No
- List of tables (if exists) Yes No
- Lab report structure Yes No
2 English Grammar and Spelling (max 6%)
- Grammar Yes No
3 Data and Result Analysis (max 85%)
Total Score
Signature:
Date:
Trang 3International University School of Computer Science & Engineering
Trang 4Contents
1 Theoretical Background
1.1 Fourier Transform
1.2 Transfer Function
1.3 Resonator Filter L.A Hamming Window escssessssssssssessssesscnsessssessesseseeseceesteseeseeeestecssteeeesteessteesseeeeateessaeesseraee
2 Experimental Procedure
2.1 Problem 1
2.2 Problem 2
3 Experimental Results,
3.1 Results of Problem 1
3.2 Results of Problem 2
4 Discussion of Results
5 References
List of Figures
List of Tables
Trang 5International University School of Computer Science & Engineering
1 Theoretical Background
1.1 Fourier Transform
- What is it?
> The Fourier transform is a mathematical function that decomposes a time-dependent waveform into frequencies The transform's output is a complex-valued frequency function
In simpler words, the Fourier transform can help find the frequencies of a function in the
time domain "!,
- How to doit?
> For doing the Fourier transform, we will use the following formula ”!:
| f(xje dx
- Example
> Applying the Fourier transform to the square wave reveals its hidden frequency components It shows a series of vertical lines on a frequency axis, representing the
different frequencies present in the signal Here is what it may look like:
DFFT of 1Hz 50% Duty-Cycle Square Wave
500 -+-i \ -4 - L - be -4 -4 - ban - fpe -d -
Se iitfiil aaa Hường ae nee === a
300 +]-F - - - iss Trennn reeeee ren
200 -1-
Frequency [Hz]
Figure 1: Example of Fourier transform (taken from” Why Fourier series and transform of a square
wave are different? - Signal Processing Stack Exchange”)
- What are the applications?
Trang 6> Fourier transform has numerous applications in real-life and here are some of them:
1 Signal processing
2 Communication system
3 Image Processing
4 Audio Processing
1.2 Transfer Function
- What is it?
> A transfer function is defined as the ratio of the output Laplace transform to the input Laplace transform, assuming that all initial conditions are zero “! It consists of seven
different types:
a) Impulse response
b) Difference equation
c) 1/0 Difference Equation
d) Frequency response
e) Block diagram of realization
f) Sample Processing Algorithm
g) Frequency Response and Pole/zero Pattern
- How to doit?
> We have the direct form to do the transfer function which is:
Y(z)
H(z)=
- Example
> Consider this system:
y(n) =O0.25 p(n - 2)+x(07)
Here by taking the z-transform of both sides of the equation we get:
¥(z) =0.252-¥(2)+ X(z)
Y(z)
Solving for * (2) we get:
Trang 7International University School of Computer Science & Engineering
H(z) =- - = +
- What are the applications?
> Transfer function can have many applications in real-life Here are some of them:
1 Control system designs
2 Electrical circuits
3 Mechanical systems
4 Robotics
1.3 Resonator Filter
- What is it?
= A resonator filter, also known as a resonant filter or a resonant circuit, is a form of electrical filter that filters or amplifies certain frequencies using the idea of resonance
- How to doit?
> Resonator filters can be implemented using various electronic components and circuit
configurations The most common types of resonator filters are based on LC (inductor-
capacitor) circuits or RLC (resistor-inductor-capacitor) circuits The resonant frequency of
the filter can be adjusted by varying the values of the inductors, capacitors, or resistors in the circuit
Example
> Let's consider an example of a resonator filter with a resonant frequency of 1 kHz The
LC circuit consists of an inductor with an inductance of 100 mH and a capacitor with a
capacitance of 10 nF By using these values, we can calculate the resonant frequency using the formula:
]
Resonant frequency (f) = 27VLC
Substituting the values: f= 1591 Hz
So, in this example, the resonant frequency of the filter would be approximately 1.591 kHz
- What are the applications?
> Here are some applications of resonator filter:
- Audio and music
Trang 8- Communication system
- Image and Signal Processing
- What is it?
> The Hamming window is a mathematical function used in signal processing and other applications to taper the edges of a signal, most notably in Fourier analysis
- How to doit?
> The mathematical expression for the Hamming Window is given by:
(0) =0.Š4 - 0.40 cos( = -)
(Eq.3) where:
1.) is the value of the window at sample n
Nis the total number of samples
By multiplying each sample of the signal by the corresponding sample by this formula:
- Example
>
- What are the applications?
> Some of the applications of Hamming Window
- Spectral Analysis
- Speech Processing
- Filter Design
- Image Processing
- RADAR and SONAR Processing
2 Experimental Procedure
2.1 Problem 1
a)
Trang 9International University School of Computer Science & Engineering
Ị km A
aa ) e ă
yea) - 16 z1Y(2) - 03x? X3) + Xca) + 072 X(2) + 0.62” X2)
© X‹z)[ƑA- 4§z2+ 0.9233 < X21 424+ 0.62°*]
Ye2) A= AS a £) 3„!
= Ac2) = M2 = — 5
b)
Code:
a= [1,0.7,0.6];
b = [1,-1.5,0.9];
x = zeros(1,100);
x(1) = 1;
h = filter(b,a,x);
h = h'
stem(h)
xlabel('n')
ylabel(’ h[n]')
title('Impulse response of filter')
b)
Output:
1.0000
-2.2000
EEO93IU
Digital Signal Processing Laboratory 9
Trang 101.8400
0.0320
-1.1264
0.7693
0.1373
-0.5577
0.3080
0.1190
-0.2681
0.1163
0.0795
-0.1254
0.0401
0.0472
-0.0571
0.0116
0.0261
-0.0253
0.0020
0.0137
-0.0108
-0.0007
0.0070
-0.0045
-0.0010
0.0034
-0.0018
-0.0008
0.0016
-0.0007
Trang 11
International University School of Computer Science & Engineering
-0.0005
0.0008
-0.0002
-0.0003
0.0003
-0.0001
-0.0002
0.0001
-0.0000
-0.0001
0.0001
0.0000
-0.0000
0.0000
0.0000
-0.0000
0.0000
0.0000
-0.0000
0.0000
0.0000
-0.0000
0.0000
0.0000
-0.0000
0.0000
0.0000
-0.0000
0.0000
0.0000
Trang 12
-0.0000
-0.0000
0.0000
-0.0000
-0.0000
0.0000
-0.0000
-0.0000
0.0000
-0.0000
-0.0000
0.0000
-0.0000
-0.0000
0.0000
-0.0000
-0.0000
0.0000
0.0000
-0.0000
0.0000
0.0000
-0.0000
0.0000
0.0000
-0.0000
0.0000
0.0000
-0.0000
0.0000
Trang 13
International University School of Computer Science & Engineering
0.0000
-0.0000
0.0000
0.0000
-0.0000
0.0000
0.0000
-0.0000
Impulse response of filter
c)
Code:
close all;
Trang 14
a= [1, 0.7, 0.6];
b= [1, -1.5, 0.9];
x = zeros(1, 100);
x(1) = 1;
h = filter(b, a, x);
h=h';
% Plot pole-zero plot
figure;
zplane(b, a);
% Plot frequency response
figure;
q = fftshift(fft(h));
subplot(2, 1, 1);
plot(linspace(-pi, pi, length(q)), abs(q));
grid on;
grid minor;
xlim([-pi, pil);
title('Magnitude of Frequency Response');
ylabel(' |H(e*{j \Omega})|');
xlabel('\Omega');
subptot(2, 1, 2);
plot(linspace(-pi, pi, Length(q)), 189/pi*angLe(q));
grid on;
grid minor;
xlim([-pi, pil);
title('Angle of Frequency Response');
ylabel('\angle H(e*{j] \Omega})');
xlabel('\Omega');
Output:
Trang 15
International University School of Computer Science & Engineering
0.6 5
0.2 fF
Trang 16
Magnitude of Frequency Response
Angle of Frequency Response
He!) oOo
2.2 Problem 2
2.3 Problem 3
3 Experimental Results
3.1 Results of Problem 1
Trang 17International University School of Computer Science & Engineering 3.2 Results of Problem 2
3.3 Results of Problem 3
4 Discussion of Results
- What have you learnt?
- Any interesting findings?
- Potential applications?
5 References
[1]: Stanford University (n.d.) Fourier Transform - GRU Retrieved from https://gru.stanford.edu/doku.php/tutorials/fouriertransform
[2]: https://examplemath.com/fourier-transform-examples