0% found this document useful (0 votes)
2 views

Signal_and_systems_lab (2)

The document provides an overview of Fourier Series and Fourier Transform analysis using MATLAB, detailing equations for synthesis and analysis for both continuous and discrete time signals. It includes MATLAB programming examples for computing the Discrete Fourier Transform (DFT) and its inverse, along with plotting the results. The content emphasizes the representation of periodic functions and sequences through complex sinusoids, highlighting their significance in signal processing.

Uploaded by

rochak niraula
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Signal_and_systems_lab (2)

The document provides an overview of Fourier Series and Fourier Transform analysis using MATLAB, detailing equations for synthesis and analysis for both continuous and discrete time signals. It includes MATLAB programming examples for computing the Discrete Fourier Transform (DFT) and its inverse, along with plotting the results. The content emphasizes the representation of periodic functions and sequences through complex sinusoids, highlighting their significance in signal processing.

Uploaded by

rochak niraula
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Fourier Series Analysis Using MATLAB

Continuous-Time Fourier Series


A very large class of functions can be represented by using Fourier series, namely most practically
useful periodic functions. The Fourier series represents a periodic function as a (possibly infinite)
linear combination of complex sinusoids.Complex sinusoids are eigenfunctions of LTI systems.
Suppose that we have a set of harmonically-related complex sinusoids of the form:

ϕk (t) = ejk(2π/T )t k = 0, 1, 2, .....

The fundamental frequency of the kth complex sinusoid ϕk is kωo ,an integer multiple of ωo .Since
the fundamental frequency of each of the harmonically-related complex sinusoids is an integer
multiple of ωo ,a linear combination of these complex sinusoids must be periodic. More specifi-
cally, a linear combination of these complex sinusoids is periodic with period T = ω2πo . Suppose
that we can represent a periodic complex-valued function x as a linear combination of harmon-
ically related complex sinusoids as :


X
x(t) = ck ejkωo t
k=−∞

Such a representation is known as a Fourier series.This equation is specifically known as Fourier


series synthesis equation.

Fourier Series Equations


Syntheis Equation
The continous time fourier series synthesis equation is given by:


X
x(t) = ck ejkωo t
k=−∞

Analysis Equation
The continuous time fourier series analysis equation is given by:

Z
1
ck = x(t)e−jkωo t dt
T T

Continuous-Time Fourier Transform


The (CT) Fourier series provides an extremely useful representation for periodic functions.
Often,however ,we need to deal with functions that are not periodic. A more general tool
than ther Fourier series is needed in this case. So, for aperiodic functions we use Fourier
Transform,which is derived from a limiting case of fourier series that a aperiodic function can
be considered as a periodic function with infinite time period.

1
Fourier Transform Equations
Analysis Equation
The continuous time fourier transfom analysis equation is :

Z ∞
X(ω) = x(t)e−jωt dt
−∞

Synthesis Equation
The continuous time fourier transform synthesis equation is :

Z ∞
1
x(t) = X(ω)ejωt dω
2π −∞

Discrete Time Fourier Series


A very large class of sequences can be represented by using Fourier series, namely most
practically useful periodic sequences. The Fourier series represents a periodic sequences as
a linear combination of complex sinusoids. This is often desirable since compled sinusiods
are easy sequences to work with. The compled sinusoids are eigensequences of LTI systems.
Consider a set of harmonically-related compled sinusoids of the form

ϕk = ej(2π/N )kn
for all k ϵ Z
where N is a positive integer constant. Since, ejθ
is 2π-periodic in variableθ,ϕk = ϕk+mN
for all m ϵ Z.Consequently , the above set of sequences contains only N distinct ele-
ments, which can be obtained by choosing k as any set of N consecutive integers.

0.1 Fourier Series Equations


0.1.1 Synthesis Equation

X
x(n) = ck ejk(2π/N )
k=<N >

0.1.2 Analysis Equation

1 X
ck = x(n)e−jk(2π/N )
N
n=<N >

0.2 Discrete Time Fourier Transform


0.2.1 Analysis Equation


X
X(Ω) = x(n)e−jΩn
n=−∞

2
0.3 Synthesis Equation

Z
1
x(n) = X(Ω)ejΩn dΩ
2π 2π

Programming With MATLAB


Program 1

clc ; clear ; close all ;

% Define parameters
M = 16; % Number of DFT points
N = 8; % Length of unit step signal
u = ones (1 , N ) ; % Unit step input

% Compute DFT using FFT


X = fft (u , M ) ;
n = 0: M -1; % Frequency index

% Plot Unit Step Signal


figure ;
subplot (3 ,1 ,1) ;
stem (0: N -1 , u , 'k ' , ' filled ' , ' LineWidth ' , 1.5) ;
title ( ' Unit Step Input ') ;
xlabel ( 'n ') ; ylabel ( 'u [ n ] ') ;
xlim ([ -1 , M ]) ; % Adjust x - axis limit
ylim ([0 , 1.5]) ; % Adjust y - axis limit
grid on ;

% Plot Magnitude Spectrum


subplot (3 ,1 ,2) ;
stem (n , abs ( X ) , 'b ' , ' filled ' , ' LineWidth ' , 1.5) ;
title ( ' Magnitude Spectrum of DFT ') ;
xlabel ( 'k ') ; ylabel ( '| X ( k ) | ') ;
xlim ([ -1 , M ]) ; % Adjust x - axis limit
grid on ;

% Plot Phase Spectrum


subplot (3 ,1 ,3) ;
stem (n , angle ( X ) , 'r ' , ' filled ' , ' LineWidth ' , 1.5) ;
title ( ' Phase Spectrum of DFT ') ;
xlabel ( 'k ') ; ylabel ( '\ angle X ( k ) ') ;
xlim ([ -1 , M ]) ; % Adjust x - axis limit
ylim ([ - pi , pi ]) ; % Limit phase values for clarity
yticks ([ - pi - pi /2 0 pi /2 pi ]) ; % Set meaningful phase tick
marks
yticklabels ({ ' -\ pi ' , ' -\ pi /2 ' , '0 ' , '\ pi /2 ' , '\ pi ' }) ;
grid on ;

3
Output

Program 2

clc ; clear ; close all ;

% Define the signal


x = [1 , 1.5 , 0.7 , 2.3 , 6 , 1 , 0 , 0]; % Input sequence

% Compute DFT using FFT


Y = fft (x , 8) ;

% Frequency index
n = 0: length ( Y ) -1;

% Plot Real Part of FFT


figure ;
subplot (2 ,1 ,1) ;
stem (n , real ( Y ) , 'b ' , ' filled ' , ' LineWidth ' , 1.5) ;
title ( ' Real Part of FFT ') ;
xlabel ( ' Frequency Index ( k ) ') ;
ylabel ( ' Re \{ X ( k ) \} ') ;
grid on ;
xlim ([0 7]) ;

% Plot Imaginary Part of FFT


subplot (2 ,1 ,2) ;
stem (n , imag ( Y ) , 'r ' , ' filled ' , ' LineWidth ' , 1.5) ;
title ( ' Imaginary Part of FFT ') ;
xlabel ( ' Frequency Index ( k ) ') ;
ylabel ( ' Im \{ X ( k ) \} ') ;
grid on ;
xlim ([0 7]) ;

4
Output

Program 3

clc ; clear ; close all ;

% Define the frequency domain sequence ( DFT coefficients )


Y = [6.0000 + 0.0000 i , -2.0000 + 2.0000 i , -2.0000 + 0.0000 i ,
-2.0000 - 2.0000 i ];

% Compute the Inverse FFT


X = ifft (Y , 4) ;

% Plot the Real & Imaginary parts of IFFT


figure ;
stem (0: length ( X ) -1 , real ( X ) , 'b ' , ' filled ' , ' LineWidth ' , 1.5)
; hold on ;
stem (0: length ( X ) -1 , imag ( X ) , 'r ' , ' filled ' , ' LineWidth ' , 1.5)
;
title ( ' Inverse FFT ( Time - Domain Signal ) ') ;
xlabel ( 'n ') ; ylabel ( 'x [ n ] ') ;
legend ( ' Real Part ' , ' Imaginary Part ') ;
grid on ;

5
Output

You might also like