lab 6
lab 6
lab 6
Objective :
This laboratory report investigates the Fourier Series Representation of basic signals such as
square waves, triangular waves, and the addition of periodic signals in MATLAB. The
primary objective is to understand how to represent periodic signals using Fourier series and
to analyze the combined signals when they are added together. MATLAB is used as the
primary tool for signal generation, Fourier analysis, and visualization.
Introduction:
The Fourier series is a powerful mathematical tool for representing periodic signals in the
frequency domain. It allows us to break down complex signals into simpler sinusoidal
components, making it easier to analyze and manipulate them. In this laboratory experiment,
we will explore the representation of basic signals and examine the results of adding periodic
signals using MATLAB.
The experimental setup consists of MATLAB as the main tool for signal generation, Fourier
analysis, and visualization. The following sections outline the steps involved in this
experiment:
In this section, we aim to represent a square wave signal using the Fourier series. The
MATLAB code provided below is used to generate the representation and plot the results.
t=linspace(-2,2,10000);
f=0;
for k=1000:1000
if k==0
continue;
end
a=((1)/(pi*k*1i)*(1-(exp(-pi*1i*k))));
x=a*exp(2*pi*1i*k.*t);
f=f+t;
end
plot (t,f)
grid on;
grid mirror;
xlabel (‘t’);
ylabel (‘f(t)’);
Output visualization :
Fourier Transform:
This section investigates the Fourier Transform of an unspecified signal. The provided code is
designed for the Fourier Transform; however, the nature of the signal is not specified. You
can modify this section as needed, replacing the signal with one of your choice.
x=0;
k=1;
t=-2:0.001:2;
for f=-5:0.001:5;
x(k)=trapz(t,exp(-1i*2*pi*f*t));
k=k+1;
end
f=-5:0.001:5;
plot (f,x)
grid on;
grid mirror;
Output visualization :
Addition of Periodic Signals:
This section explores the addition of two periodic signals. The MATLAB code provided is
intended to represent the sum of two cosine signals in the frequency domain.
x=0;
k=1;
t=-2:0.001:2;
for f=0:800;
x(k)=trapz(t,cos(2*pi*100*t).*exp(-1i*2*pi*f*t))+trapz(t,cos(2*pi*500*t).*exp(-
1i*2*pi*f*t));
k=k+1;
end
f=0:800;
plot (f,x)
grid on;
grid mirror;
Output visualization :
In this section, we focus on the representation of a triangular signal using the Fourier series.
The provided code is used to generate the representation and plot the results.
MATLAB code for Fourier Series Representation of Triangular Signal:
x=0;
k=1;
t=-20:0.001:2;
f=0;
for k=-200:200;
if k==0
continue;
end
a=(-1(2*pi))*(((pi*exp(-1j*k*pi))/(1j*k))+((exp(-1j*k*1j*k)));
x=a*exp(1j*k.*t);
f=f+x;
end
f=-5:0.001:5;
plot (t,f)
grid on;
grid mirror;
Output visualization :
This section discusses the results obtained from the MATLAB simulations in each of the
above sections. It includes the time domain and frequency domain plots, highlighting the key
observations and findings. Specifically, you can discuss:
- The accuracy of Fourier series representation in capturing the characteristics of the square
wave and triangular wave signals.
- The impact of adding periodic signals and how the frequency domain representation
changes.
Conclusion: