Lab 2 Fourier Series & Fourier Transforms: 2.1. Objectives
Lab 2 Fourier Series & Fourier Transforms: 2.1. Objectives
Lab 2 Fourier Series & Fourier Transforms: 2.1. Objectives
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
−∞
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:
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.
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.