Ss Lab 09
Ss Lab 09
Fourier Transform
Objective
1. To verify the Amplitude and Phase spectra of aperiodic signals using MATLAB and Fourier
Transform.
2. To plot and observe the actual signals and their spectra
Theory
Fourier Transform
The Fourier transform is in fact an extension of the Fourier series, which doesn’t accurately
approximate continuous-time aperiodic signals. The Fourier transform of a continuous time signal
x(t) is represented by X(f). The Fourier transform is obtained by extending the expansion interval to
infinity, i.e. T→∞. The resulting mathematical form of the Fourier transform is:
In Matlab environment, the Fourier transform can be computed as by using the following
command:
fourier(f) returns the Fourier transform of ‘f’ using the default independent variable x and the
default transformation variable w. Similarly,
ifourier(F) returns the inverse Fourier transform of F using the default independent variable w for
the default transformation variable x.
-x
In order to find Fourier transform you need to use a variable symbol such as in e , x is the symbolic
variable. In Matlab, we need to define ‘x’ as symbol which could be done by using the Matlab
command “syms()” .
Go to Mathworks page and read about “syms()” and why we are using it here.
Page 1 of 6
Solve the following Fourier Transform examples in Matlab. Get help from Google and try to
understand how we are calculating the Fourier transform of each function.
syms x;
f = exp(-x^2);
fourier(f)
answer will be pi^(1/2)/exp(w^2/4)
syms x y;
f = exp(-x^2);
fourier(f,x,y)
syms w;
g = exp(-abs(w));
a = fourier(g)
returns
a=
2/(v^2 + 1)
pretty(a)
2
------
2
v+1
syms x u;
f = x*exp(-abs(x));
a = fourier(f,u)
returns
Page 2 of 6
a=
-(u*4*i)/(u^2 + 1)^2
Comments: Please perform all the above examples in Matlab for your understanding.
Lab Task(s)
-3t
1) A function x(t)=e u(t) is given. Find the Fourier transform of this function in your
notebooks and draw its frequency domain amplitude spectrum X(w) and its magnitude
spectrum |X(w)|.
Hint: First of all plot the function x(t), and then X(w) and its magnitude spectrum |X(w) using
the subplot() command. For frequency domain plotting, use the frequency from -1 to 1 Hz.
-3t
2) Plot the phase spectrum of the signal x(t)=e u(t), after finding its Fourier transform.
Please explore how you can plot the phase spectrum in Matlab. Use the frequency from -1
to 1 Hz.
Program:
t=-1:0.01:3;
ut=[zeros(1,100) ones(1,301)];
a=3;
xt=exp(-a*t).*ut;
f=-1:0.001:1;
Xf=1./(a+j*2*f*pi)
xphase=angle(Xf);
xamp=abs(Xf);
subplot(2,2,1)
plot(t, xt)
grid
subplot(2,2,2)
plot(f, xphase)
grid
subplot(2,2,3)
plot(f, xamp)
grid
Page 3 of 6
In Matlab, we can compute the Fourier transform of a signal using the function fft()
fft(X) computes the discrete Fourier transform (DFT) of X using a fast Fourier transform (FFT)
algorithm.
Y = fft(X,n) returns the n-point DFT. If no value is specified, Y is the same size as X.
Page 4 of 6
Example:
Program1:
When analyzing the frequency components of signals, it can be helpful to shift the zero-frequency
components to the center. Create a signal S, compute its Fourier transform, and plot the power.
S = cos(2*pi*15*t)
fs = 100; % sampling
frequency t = 0:(1/fs):(10-1/fs); % time
vector
S =
cos(2*pi*15*t); n
= length(S);
X = fft(S);
f = (0:n-1)*(fs/n); %frequency
range power = abs(X).^2/n; %power
plot(f,power)
Program2
Use Fourier transforms to find the frequency components of a given signal having a frequency of
50 Hz and a sampling frequency of 1000 Hz. Take the signal length to be 1000. Please run the
following code and generate the results.
S = 0.7*sin(2*pi*50*t)
Page 5 of 6
ylabel('X(t)')
subplot(2,1,2)
plot(f1,P2)
title('Signal in Frequency Domain')
xlabel('f (Hz)')
ylabel('|P1(f)|')
Exercise
S = 2*sin(2*pi*25*t) + 3*sin(2*pi*50*t);
Plot the time domain and frequency domain plot for the above signal using 10 cycles if the
sampling frequency is 1000 Hz.
Review Questions:
Page 6 of 6
4. What is Phase Spectrum?
Page 7 of 6