Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Lab 2 Fourier Series & Fourier Transforms: 2.1. Objectives

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

LAB 2

Fourier Series & Fourier Transforms


2.1. Objectives
Fourier analysis plays an important role in communication theory. The main
objectives of this experiment are:
 To gain a good understanding and practice with Fourier series and Fourier
Transform techniques, and their applications in communication theory.
 Learn how to implement Fourier analysis techniques using MATLAB.
2.2. Introduction
2.3.1. Fourier Series
A Fourier series is the orthogonal expansion of periodic signals with period T0

when the signal set { e j2 π nt /T }n=−∞


0
is employed as the basis for the expansion. With
this basis, any given periodic signal x(t) with period T0 can be expressed as:

j 2 πnt/T 0
x(t)=∑ x n e
−∞
Where the xn’s are called the Fourier series coefficients of the signal x(t). These
coefficients are given by:
T0
1 − j 2 π nt /T 0
x n= ∫ x (t )e dt
T0 0
This type of Fourier series is called the exponential Fourier series. The frequency
f0=1/T0 is called the fundamental frequency of the periodic signal. The n th harmonic
is given by the frequency fn = nf0.
If x(t) is a real-valued periodic signal, then the conjugate symmetry property is
satisfied. This basically states that x-n = xn*, where * denotes the complex
conjugate. That is, one can compute the negative coefficients by only taking the
complex conjugate of the positive coefficients. Based on this result, it is obvious to
see that:
| xn | = | x-n |
∠ x n=−∠x −n

1
2.3.2. Fourier Transforms
The Fourier transform is an extension of the Fourier series to arbitrary signals. As
you have seen in class, the Fourier Transform of a signal x(t), denoted by X( f), is
defined by:

X( f )= ∫ x(t )e−2π ft dt
−∞
On the other hand, the inverse Fourier Transform is given by:

x(t)= ∫ X(f )e2π ft df
−∞

If x(t) is a real signal, then X( f) satisfies the following conjugate symmetry


property:
X (−f )= X ¿ ( f )
In other words, the magnitude spectrum is even while the phase spectrum is odd.
There are many properties satisfied by the Fourier Transform. These include
Linearity, Duality, Scaling, Time Shift, Modulation, Differentiation, Integration,
Convolution, and Parserval’s relation.
2.3. Lab Work
2.3.1. Fourier Series
 In MATLAB, run fseriesdemo.m file. This will bring up a Graphical User
Interface (GUI) that can be used to test and demonstrate many concepts and
properties of the Fourier series expansion.
 Try different types of functions, starting with the square wave, fully
rectified sine, sawtooth, etc. Run different examples while changing the
fundamental frequency and number of harmonics in the FS expansion.
Report your observations. In particular, explain why the Fourier series for
the square and sawtooth waves require many more harmonics than the
rectified sine waves in order to get a close match between the FS and the
original function?

2
 Consider the plots for amplitude and phase spectra. State what can of
symmetry is present in each type of spectrum, and why? The plots also
indicate the presence of FS terms with “negative” frequencies! What’s the
interpretation of that? Are there really negative frequencies? Explain.
 Now, consider a periodic signal x(t). Compute and plot the discrete
magnitude and phase spectra of this signal given by x(t) = e-t/2 where t ∈
[0,π]. For this, you need to use the Fast Fourier Transform (FFT) function
in MATLAB (refer to the notes below for more details). For the expansion
of the signal x(t), the number of harmonics N0 to be used should be 32, the
period T0 is π , and the step size is ts=T0/N0. The output should be in two
figure windows. The first window should contain x(t) while the second
window should contain both the magnitude and phase spectra versus a
vector of harmonics indices (for example, n). You also need to include
labels and titles in all plots. What can you observe from these plots?
Notes: In MATLAB, Fourier series computations are performed numerically using
the Discrete Fourier Transform (DFT), which in turn is implemented numerically
using an efficient algorithm known as the Fast Fourier Transform (FFT). You
should also type: help fft at the MATLAB prompt and browse through the online
description of the fft function.
Because of the peculiar way MATLAB implements the FFT algorithm, the fft
MATLAB function will provide you with the positive Fourier coefficients
including the coefficient located at 0 Hz. You need to use the even amplitude
symmetry and odd phase symmetry properties of the Fourier series for real signals
(see the introduction to Fourier series of this experiment) in order to find the
coefficients for negative harmonics.
As an illustration, the following code shows how to use fft to obtain Fourier
expansion coefficients. You can study this code, and further enhance it to complete
your work.
Xn = fft(x,No)/No;
Xn = [conj(Xn(No:-1:2)), Xn];
Xnmag = abs(Xn);

3
Xnangle = angle(Xn);
k=-N0/2+1:N0/2-1
stem(k, Xnmag(No/2+1:length(Xn)-No/2))
stem(k,Xnangle(No/2+1:length(Xn)-No/2))
Useful MATLAB Functions: exp, fft(x,No), length( ), conj, abs, angle, stem,
figure, xlabel, ylabel, title.
2.3.2. Fourier Transform
 Now, consider the signals x1(t) and x2(t) described as follows:

x1(t)=¿ {t+1,ư−1≤t≤0¿{1,ư 0<t≤1¿¿ ¿


x2(t)=¿ {t ,ư 0≤t≤1¿ {1,ư 1<t≤2¿¿ ¿
 Plot these signals and their relative spectra in MATLAB. What do you
conclude from the results you obtained? Are there any differences?
 You need to plot both time signals in one figure window. Similarly, you
need to plot the magnitude and phase spectra for both signals in one figure
window, i.e, overlapping each other. For the phase, display small values by
using the axis command. You also need to normalize the magnitude and
phase values, and you should include the labels, titles, grid, etc. Assume the
x-axis to work as a ruler of units. Each unit contains 100 points and let the
starting point to be at –5 and the last point to be at 5.
Notes: Similar to Fourier series, Fourier transform computations in MATLAB are
easily implemented using the fft function. The following code illustrates that.
Notice in particular the function fftshift is very useful for presenting the Fourier
spectrum in an understandable format. The internal algorithm used in MATLAB to
find the FFT points spreads the signal points in the frequency domain at the edges
of the plotting area, and the function fftshift centers the frequency plots back
around the origin.
X = fft(x);

4
X = fftshift(X);
Xmag = abs(X);
Xmag = Xmag/max(X1mag);%Normalization
Xangle = angle(X);
Xangle = Xangle/max(Xangle);
F = [-length(X)/2:(length(X)/2)-1]*fs/length(X);
plot(F, Xmag), plot(F, Xangle);
 Repeat the above for the following signals, and report your observations &
conclusions.

x1(t)=¿ {1 ,ư|t|≤3 ¿ ¿¿¿


x2(t)=¿ {1 ,ư|t|≤1 ¿ ¿¿¿

5
Bài thực hành số 2: Chuỗi Fourier và biến đổi Fourier
1. Mục tiêu: Việc phân tích Fourier đóng vai trò quan trọng trong lý thuyết
truyền thông. Mục đích chính của bài thí nghiệm này là:
 Hiểu và thực hành tốt với chuỗi Fourier, kĩ thuật biến đổi Fourier và ứng
dụng của nó trong lý thuyết truyền thông.
 Học được cách triển khai kỹ thuật phân tích Fourier bằng MATLAB.
2. Cơ sở lý thuyết:
Sinh viên tìm hiểu lý thuyết về chuỗi Fourier và biến đổi Fourier, và biến
đổi Fourier ngược.
Sinh viên tìm hiểu thêm trong tài liệu tiếng Anh bên trên.
Các hàm hữu ích khi sử dụng chuỗi Fourier trong MATLAB:
 exp(x) : hàm e mũ n.
 fft(x,N0): hàm biến đổi fourier nhanh của tín hiệu x.
 length(): tính độ dài của ma trận hoặc vector.
 cọn: tính liên hợp phức của một số.
 abs(x): lấy giá trị tuyệt đối của x nếu x là số thực, lấy độ lớn của x
nếu x là số phức.
 angle: tính pha theo radian của ma trận với các phần tử phức.
 stem: vẽ tín hiệu rời rạc.
 figure: đặt tên cho form.
Các bài tập sinh viên phải hoàn thành trong bài thực hành số 2
Bài 1:
Cho hàm x(t)=e^(-t/2), t=[0,π], bước nhảy ts=T 0/N0, T0=π, N0=100. Biểu diễn
phổ biên độ và phổ pha của x(t).
Bài 2:
Cho hai hàm x1(t) và x2(t) như sau:

6
t  1, 1  t  0 t ,0  t  1
 
x1 (t )  1,0  t  1 x2 (t )  1,1  t  2
0, elsewhere 0, elsewhere
 
Vẽ đồ thị trong miền thời gian x 1,2(t), phổ biên độ của x1,2(t) và phổ pha của
x1,2(t). Nhận xét.
Bài 3:
Cho hai hàm x1(t) và x2(t) như sau:
1, t  3 1, t  1
x1 (t )   x2 (t )  
0, elsewhere 0, elsewhere
Vẽ đồ thị trong miền thời gian x1,2(t), phổ biên độ của x1,2(t) và phổ pha
của x1,2(t). Nhận xét.

You might also like