You are on page 1of 14

NED University of Engineering &

TechnologyDepartment of Electrical
Engineering

SIGNALS AND SYSTEMS


(EE-231)

INSTRUCTOR : DR MUHAMMAD ALI BAIG

SUBMITTED BY

{MUHAMMAD MUDASSIR } {EE-21021 }


{ABAN KHAN } {EE-21022 }
{UZAIR RASHID} {EE-21026 }
{ATTA UR REHMAN} {EE-21033 }
{ZAEEM ALI} {EE-21333 }
: To verify Fourier’s analysis of a periodic signal with Matlab.

Fourier claimed that:

• Any periodic signal can be expressed as a summation of infinite number of sines and
cosines.
• The lowest frequency is called the fundamental frequency. The integral multiples of
fundamental frequencies are called ‘harmonics’ i.e. all the frequencies are harmonically
related.
• The period of the fundamental signal will be dominant because the pattern will only
repeat itself when every component has contributed and completed its cycle. Hence
when the slowest (fundamental) signal will complete its cycle, then only the resultant
signal will generate a repeating pattern. So it can be concluded that the period of the
resultant wave will be equal to the time period of the fundamental wave.

Consider a periodic signal x(t), according to Fourier this periodic signal can be expressed as a
summation of infinite amount of sines and cosines:

Where,
‘n’ is the harmonic order
‘Wo’ is the fundamental frequency
Now we are going to see if the components of Fourier series we obtained really add up to
construct the given signal. So we are going to plot its components on matlab for verification.

MATLAB CODE:
t = -4:0.001:2;
x = 0;
an = 0;
bn = 0;
at=1/6;
bt=0;

% creating for loop for summation

for n = 1:1000;
an = (3/(2*n*n*pi*pi))*(cos(2*n*pi/3)+(2*n*pi/3)*sin(2*n*pi/3)-1);
bn = (3/(2*pi*pi*n*n))*(sin(2*n*pi/3)-(2*n*pi/3)*cos(2*n*pi/3));
at = at+an*cos(2*n*pi/3*t);
bt = bt+bn*sin(2*n*pi/3*t);
x = at + bt;
end

% Create a new figure window

figure;

% Plot the first graph in the first subplot

subplot(1,3, 1);
plot(t,at),xlabel('time');
title('Summation of cosines');

% Plot the second graph in the second subplot

subplot(1,3, 2);
plot(t,bt), xlabel('time');
title('summation of sines');

% Plot the third graph in the third subplot

subplot(1, 3, 3);
plot(t,x), xlabel('time'),ylabel('x(t)');
title('Summation of sines and cosines');
1) for n = 1:
2) for n = 5:

3) for n = 50:

4)for n = 5000:
% Parameters
N = 10; % Number of terms in the series

% Initialize arrays
n = 0:N;
Cn = zeros(size(n));
Theta_n = zeros(size(n));

% Calculate Cn and Theta_n


for i = 1:numel(n)
if n(i) ~= 0
Cn(i) = 3 / (2 * n(i)^2 * pi^2) * sqrt(2 + 4 * n(i)^2 * pi^2 /
9 - 2 * cos(2 * n(i) * pi / 3) - 4 * n(i) * pi / 3 * sin(2 * n(i) * pi
/ 3));
Theta_n(i) = atan((2 * n(i) * pi / 3 * cos(2 * n(i) * pi / 3)
- sin(2 * n(i) * pi / 3)) / (cos(2 * n(i) * pi / 3) + 2 * n(i) * pi /
3 * sin(2 * n(i) * pi / 3) - 1));
else
Cn(i) = 0; % For n = 0, Cn is zero
Theta_n(i) = 0; % For n = 0, Theta_n is zero
end
end

% Convert angles to degrees


Theta_n_deg = rad2deg(Theta_n);

% Plot spectrum
figure;
stem(n, Cn);
title('Amplitude Spectrum');
xlabel('n');
ylabel('Amplitude (Cn)');

% Plot phase
figure;
stem(n, Theta_n_deg);
title('Phase Spectrum');
xlabel('n');
ylabel('Angle (Theta_n) [degrees]');
CONCLUSION:
In this task, the given periodic signal was analyzed using Fourier's hypothesis, and MATLAB
was employed to verify the results. By applying Fourier analysis, the periodic signal was
decomposed into a sum of sinusoidal components of different frequencies, magnitudes, and
phases. MATLAB's functionalities allowed for efficient computation and visualization of the
Fourier series coefficients and reconstructed signal.

The analysis demonstrated that Fourier's hypothesis provides a powerful framework for
understanding and representing periodic signals in terms of their frequency content. By
decomposing the original signal into its constituent sinusoids, we gained insights into the
dominant frequencies present in the signal and their relative amplitudes. Moreover, MATLAB's
verification further validated the correctness of the applied Fourier analysis.

Overall, this experiment showcased the significance of Fourier's hypothesis in signal


processing, highlighting its ability to represent complex periodic signals in a concise and
meaningful manner. The combination of theoretical concepts and computational tools like
MATLAB contributed to a comprehensive understanding of Fourier analysis and its practical
application.

You might also like