Signals and Systems Lab - Assignment2
Signals and Systems Lab - Assignment2
Lab Exercise # 2
Date 23.11.202
Grading Rubric
Completeness of the report Grading
scheme
Organization of the report 10%
Clear PDF, with cover sheet, answers are in the same order
as questions in the assignment, copies of the questions
Quality of figures 10%
Correctly labeled with title, x-axis, y-axis, and name(s)
Understanding of the questions and provide a complete 80%
answers
1
A) Calculate the Fourier series coefficients 𝐶𝑘 for the given signal mathematically then write down
the Fourier series expansion 𝑥(𝑡).
2
3
B) Verify your solution using Matlab by showing the magnitude and phase plots.
clear ,clc;
figure(1);
n=10; %Number of Terms of FS
k=-n:n; %Summation from -n to n
ck=((exp(2)-1)./(2*(1-(k.*pi.*1i))));
ak(n+1)=((exp(2)/2)-(1/2))-1;
subplot 121
stem(k,abs(ck),"LineWidth",1.5);grid;xlabel('t');ylabel('x(t)');%plot ampletude
title('The magnitude Spectrum','FontSize',11)
xlabel('frequency')
ylabel('|Ck|')
subplot 122
P=angle(ck);stem(k,P,'LineWidth',1.5);grid;xlabel('t');ylabel('x(t)');%plot Phase
title('The Phase Spectrum','FontSize',11)
xlabel('frequency')
ylabel('theata')
4
2- Given the following periodic signal with a period T: (2.5 Marks)
𝑓(𝑡) = 2𝑗 − 4sin (100𝜋𝑡 − 40) − 10 cos (60𝜋𝑡 + 𝜋 − 70)
a) Find the period 𝑇 and the fundamental frequency 𝑓𝑜
Solve the problem mathematically to find the exponential Fourier series then:
5
b) Use Matlab to plot the one sided spectrum.
clear ,clc;
figure(1);
f=[0 30 50];
A=[2 5 2];
subplot 121
stem(f,A,"LineWidth",2);%plot ampletude
title('The magnitude Spectrum','FontSize',11)
xlabel('frequency')
ylabel('Magnitude')
subplot 122
angle=[90 -70 50];
stem(f,angle,'LineWidth',1.5);%plot Phase
title('The Phase Spectrum','FontSize',11)
xlabel('frequency')
ylabel('theata')
clear ,clc;
figure(1);
f=[-50 -30 0 30 50];
A=[2 5 2 5 2];
subplot 121
stem(f,A,"LineWidth",2);%plot ampletude
title('The magnitude Spectrum','FontSize',11)
xlabel('frequency')
ylabel('Magnitude')
6
subplot 122
angle=[-50 70 90 -70 50];
stem(f,angle,'LineWidth',1.5);%plot Phase
title('The Phase Spectrum','FontSize',11)
xlabel('frequency')
ylabel('theata')
7
3- Suppose that a signal 𝑥(𝑡)is given by 𝑥(𝑡) = 𝑡𝑒 −3𝑡 𝑢(𝑡). Compute the Fourier Transform 𝑋(𝜔) of
the signal and plot for X-axis is −20 ≤ 𝜔 ≤ 20 𝑟𝑎𝑑/𝑠𝑒𝑐. (2.5 Marks)
a- The Magnitude of 𝑋(𝜔)
b- The Phase of 𝑋(𝜔)
c- Calculate the inverse Fourier transform of 𝑋(𝜔)
8
9
4- Use Matlab to plot the spectrum of the following two signals: (2.5 Marks)
sin(𝜋𝑡)
a- 𝑥(𝑡) = 𝜋𝑡
1 −1≤𝑡 ≤1
b- 𝑦(𝑡) = {
0 𝑒𝑙𝑠𝑒
a)
% Define time and sampling parameters
t = -2:0.01:2-0.01; % Time vector from -2 to 2 seconds, step size of 0.01
fs = 400; % Sampling frequency of 400 Hz
x = sinc(t); % Signal x(t) = sinc(t)
12