0% found this document useful (0 votes)
65 views4 pages

SNS Lab 10 19-Ee-0

This lab report summarizes tasks completed for a signals and systems lab. Three periodic signals with a period of 1 (x(t) = cos(wot), y(t) = sin(wot), z(t) = x(t)y(t)) were plotted in the time domain and analyzed in the frequency domain using FFT. MATLAB code is included to generate the plots. The report also defines the purpose of common MATLAB commands used in signal processing like fftshift, fft, abs, and length.

Uploaded by

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

SNS Lab 10 19-Ee-0

This lab report summarizes tasks completed for a signals and systems lab. Three periodic signals with a period of 1 (x(t) = cos(wot), y(t) = sin(wot), z(t) = x(t)y(t)) were plotted in the time domain and analyzed in the frequency domain using FFT. MATLAB code is included to generate the plots. The report also defines the purpose of common MATLAB commands used in signal processing like fftshift, fft, abs, and length.

Uploaded by

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

LAB REPORT 10

Signals & Systems (S&S)


(LAB)

SUBMITED TO
Engr. Hammad Haider

SUBMITED BY
Muhammad Uzair Shafique

Roll number: 19-EE-18


Section: B

DEPARTMENT OF ELECTRICAL ENGINEERING &


TECHNOLOGY, TAXILA
Date: 28-7-2021
Tasks 1:
Consider the following three continuous time periodic signals with T = 1 i-e wo
=2𝜋/𝑇 . Plot this signal in time domain. Perform frequency domain analysis on z(t)
using fft command
x(t) = cos(wot)
y(t) = sin(wot)
z(t) = x(t)y(t)

MATLAB CODE:
%uzair Shafique
%19-EE-18
clc;
clear all;
t= 0:0.01:10;
w0= 2*pi;
x= cos(w0*t);
subplot(3,2,1);
plot(t,x,'r','linewidth',3);
xlabel('time');
ylabel('cos(w0*t)');
title('Time domain representation');
grid;
w= -length(t)/2:length(t)/2-1;
y= fftshift(fft(x)/length(x));
subplot(3,2,2);
stem(w+1/2,abs(y),'linewidth',2);
grid;
axis([-10 10 0 1.5]);
xlabel('Frequency(Hz)');
ylabel('Magnitude Response');
title('Frequency Domain Representation');
Y= sin(w0*t);
subplot(3,2,3);
plot(t,Y,'r','linewidth',3);
xlabel('time');
ylabel('sin(w0*t)');
title('Time domain representation');
grid;
w= -length(t)/2:length(t)/2-1;
y= fftshift(fft(Y)/length(Y));
subplot(3,2,4);
stem(w+1/2,abs(y),'linewidth',2);
grid;
axis([-10 10 0 1.5]);
xlabel('Frequency(Hz)');
ylabel('Magnitude Response');
title('Frequency Domain Representation');
Z= sin(w0*t).*cos(w0*t);
subplot(3,2,5);
plot(t,Z,'r','linewidth',3);
xlabel('time');
ylabel('z(t)');
title('Time domain representation');
grid;
w= -length(t)/2:length(t)/2-1;
y= fftshift(fft(Z)/length(Z));
subplot(3,2,6);
stem(w+1/2,abs(y),'linewidth',2);
grid;
axis([-10 10 0 1.5]);
xlabel('Frequency(Hz)');
ylabel('Magnitude Response');
title('Frequency Domain Representation');
suptitle('19-EE-18');

OUTPUT:

19-EE-18
1

19-EE-18

Tasks 2:
Write the use of following commands?
• fftshift
• fft
• abs
• length
fftshift
fftshift rearranges a Fourier transform by shifting the zero-frequency component
to the center of the array.
Y = fftshift ( X ) If X is a vector, then fftshift swaps the left and right halves of X . If X
is a matrix, then fftshift swaps the first quadrant of X with the third, and the
second quadrant with the fourth.

Fft
It computes the Fourier transform (FT) of X using a fast Fourier transform (FFT)
algorithm.
Y = fft( X ) If X is a vector, then fft(X) returns the Fourier transform of the vector. If
X is a matrix, then fft(X) treats the columns of X as vectors and returns the Fourier
transform of each column.

Abs
Y = abs( X ) return the absolute value of each element in array X . If X is complex,
abs(X) return the complex magnitude.

Length
length (MATLAB Functions) The statement length(X) is equivalent to max(size(X))
for nonempty arrays and 0 for empty arrays. n = length(X) returns the size of the
longest dimension of X . If X is a vector, this is the same as its length.

You might also like