Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

Pak-Austria Fachhochschule Institute of Applied

Sciences and Technology, Haripur, Pakistan

DEPARTMENT OF ELECTRICAL ENGINEERING


COURSE: SIGNAL AND SYSTEMS
COURSE CODE: ECE-251
Lab Report
LAB 03
Submitted by:
Name: Muhammad Usman Jadoon
Reg# B20F0447EE031

Submitted to:
Name: Rafi Ullah
Designation: LAB Engineer

Date:
FEBRUARY 23, 2022
SIGNAL TRANSFORMATION
OBJECTIVE:
Objective of this lab is to understand the signal transformations Implement transformation such
as time shifting, time reversal, scaling adding and multiplication to signals

Software:
MATLAB

TIME REVERSAL:
It is a reflected back signal along its own axis. If a signal is in right side of axis and when reversed
when it will along go to negative axis with 0. 0 will not be changed.
Representation:
Y(t)=x(-t)
We can change the function or we can change the plot x axis by replacing signs as we need for
our requirement.

TIME SHIFTING:
It is shifting the signal if it is minus then right signal shifted it will be called delayed signal or it is
plus then it will be shifted towards right and will be called advances signal. In theory it is t-t0 will
be shift towards right but in MATLAB it will be shift towards left as it works on mathematical
operations. We will put to=-to so now it will work according to theory concept.

TIME SCALING:
Time scaling compresses or dilates a signal by multiplying the time variable by some quantity.
Time scaling of signals of signals involves the modification of a periodicity of the signal, keeping
its amplitude constant. Its mathematically expressed as,
Representation:
Y (t) = βX(t)
Where, X(t) is the original signal, and β is the scaling factor. If β > 1 implies, the signal is
compressed. And if β < 1 implies, the signal is expanded. Following example will help you
understand the time scaling property with the help of MATLAB’s has a builtin function tripuls to
generate a triangular pulse
EVEN AND ODD SIGNALS:
One of characteristics of signal is symmetry that may be useful for signal analysis. Even signals
are symmetric around vertical axis, and Odd signals are symmetric about origin.
Even Signal: A signal is referred to as an even if it is identical to its time-reversed counterparts;
Representation:
x(t) = x(-t).
Odd Signal: A signal is odd if
Representation:
x(t) = -x(-t). An odd signal must be 0 at t=0, in other words, odd signal passes the origin.
Lab 03 Tasks
TASK 1:
1. Draw a signal the following signal in MATLAB and flip it. Explore fliplr command and
compare the results

Fig. Task 1: Input signal to be flipped

ANSWER:
CODE:
n=-9:9;
x=[0 0 0 0 0 0 0 0 0 0 1 1 1 3 3 3 -2 -2 -2];
figure(1)
subplot(2,1,1)
stem(n,x)
title(" given signal ")
xlabel("n")
ylabel("x(n)")
xticks([-8 -6 -4 -2 0 2 4 6 8])
xticklabels({'-8','-6','-4','-2','0','2','4','6','8'})
x_f=fliplr(x);
subplot(2,1,2)
stem(n,x_f)
title(" flipped signal ")
xlabel("n")
ylabel("x_f(n)")
xticks([-8 -6 -4 -2 0 2 4 6 8])
xticklabels({'-8','-6','-4','-2','0','2','4','6','8'})

OUTPUT:

EXPLANATION:
In this task we were given a signal and were asked to flipped that signal by flip command. We
first made a signal from -9 to 9 having signal has 1 x(n) at 1,2 and 3 positions and signal has 3 x(N)
at 4 and 5 positons and -2 x(n) at 6,7 and 8 positions. Stem command is used to plot the signal.
Signal has been flipped by fliplr(x) command.

TASK 2:
2. For the above designed signal perform the following.
• Expand the signal by 2.
Demonstrate all the steps and enter screenshots.
• Now compress the signal as a result of part (a) by a factor of 3.
• Time Expand the signal by a factor of 2.
ANSWER:
CODE:
x_a=2*x; % expand the signal by 2 %
x_b=x_a/3; % compress the signal obtained in part(a) by 3 %
x_c=[]; % time expand the signal by factor 2%
j=1;
for i=1:length(x)
x_c=[x_c x(i)];
if(i ~= length(x))
for m = 1:j
x_c=[x_c 0];
end
end
end
n1=-18:18;
figure(2)
subplot(3,1,1)
stem(n,x_a)
title('EXPAND THE SIGNAL BY 2')
xlabel('n')
ylabel('x_a')
subplot(3,1,2)
stem(n,x_b)
title('COMPRESS THE SIGNAL BY 3 part (a)')
xlabel('n')
ylabel('x_b')
subplot(3,1,3)
stem(n1,x_c)
title('TIME SIGNAL EXPANSION BY 2')
xlabel('n')
ylabel('x_c')
xticks([-16 -14 -12 -10 -8 -6 -4 -2 0 2 4 6 8 10 12 14 16 18])
xticklabels({-16','-14','-12','-10','-8','-6','-4','-2','0','2','4','6','8','10','12','14','16'})
OUTPUT:
EXPLANATION:
We were given to signal and asked to expand and compress the signal as well as time expansion
of a signal.

TASK 3:
3. Explore the commands for below functions.
• Real part of the signal
• imaginary part of the signal
• angle
• complex
• conjugate
Take a vector of any 10 complex numbers and implement above mentioned commands
on it.

ANSWER:
• Real part of the signal
Re = real(Z);

• imaginary part of the signal


Im = imag(Z);

• angle
theta = angle(Z);

• complex
mag = abs(Z);

• conjugate
con = conj(Z);

Take a vector of any 10 complex numbers and implement above mentioned commands
on it.

CODE:
• Take a vector of any 10 complex numbers and implement above mentioned commands
on it.

Z = [0.5i 1+3i -2.2 1-3i 0.5+2i 0.4-0.4i 1+i 1-i 3+i 3-i];
OUTPUT:
Output of real and imaginary signals
Output of theta and magnitude signals

Output of complex and conjugate signals


EXPLANATION:
We first explored the commands for the signal, then take 10 random vectors and displayed them

by using disp command.


TASK 4:
4. Which of the following signals are even and which of the following signal are odd?
• [2 2 2 5 2 2 2]
• [2 2 2 5 -2 -2 -2]
• [2 1 2 3 3 2 4 5]
• [1 1 1 1 1 1 1]

ANSWER:
• [2 2 2 5 2 2 2]
Original signal: Flipped Signal:

So it is an EVEN signal.
• [2 2 2 5 -2 -2 -2]
Original Signal: Flipped Signal:

So it is an ODD signal.
• [2 1 2 3 3 2 4 5]

Original Signal: Flipped Signal:

So it is an ODD signal.

• [1 1 1 1 1 1 1]
Original Signal: Flipped Signal:
So it is an EVEN signal.

EXPLANATION:
It a signal is equal back to its flipped signal then it is an even signal.

TASK 5:
5. Prove your answer by decomposing your signals into even and odd parts. Using even
and odd part of signal reconstruct your original signal back using
x(t) = xe(t) + xo(t)

ANSWER:
CODE:
1st SIGNAL:
n=-3:3;
a=[2 2 2 5 2 2 2];
a_reverse = fliplr(a);
ae = (a + a_reverse)/2; % even part of the signal
ao = (a - a_reverse)/2; % odd part of the signal
a1 = ae+ao;
subplot(3,1,1);
stem(n,ae);
title(" even part of signal ")
subplot(3,1,2);
stem(n,ao);
title(" odd part of signal ")
subplot(3,1,3);
stem(n,a1);
title(" Full signal ")
SIGNAL 1 OUTPUT:

2ND SIGNAL CODE :


n=-3:3;
b = [2 2 2 5 -2 -2 -2];
b_reverse = fliplr(b);
be = (b + b_reverse)/2; % even part of the signal
bo = (b - b_reverse)/2; % odd part of the signal
b1 = be+bo;
subplot(3,1,1);
stem(n,be);
title('even part of signal');
stem(n,bo);
subplot(3,1,2);
title('odd part of signal');
subplot(3,1,3);
stem(n,b1);
title('full signal');
SIGNAL 2 OUTPUT:

3RD SIGNAL CODE :


n=-4:3;
c = [2 1 2 3 3 2 4 5];
c_reverse = fliplr(c);
ce = (c + c_reverse)/2; % even part of the signal
co = (c - c_reverse)/2; % odd part of the signal
c1 = ce+co;
subplot(3,1,1);
stem(n,ce);
title('even part of signal');
subplot(3,1,2);
stem(n,co);
title('odd part of signal');
subplot(3,1,3);
stem(n,c1);
title('full signal');
SIGNAL 3 OUTPUT:

4TH SIGNAL CODE :


n=-3:3;
d = [1 1 1 1 1 1 1];
d_reverse = fliplr(d);
de = (d + d_reverse)/2; % even part of the signal
do = (d - d_reverse)/2; % odd part of the signal
d1 = de+do;
subplot(3,1,1);
stem(n,de);
title('even part of signal');
subplot(3,1,2);
stem(n,do);
title('odd part of signal');
subplot(3,1,3);
stem(n,d1);
title('full signal');
SIGNAL 4 OUTPUT:

EXPLANATION:
We were asked to put the signal into its odd and even parts and then asked to combine
these signals. We have done this by help of given function and plotted the 3 part of signals
into single part.
CONCLUSION:
In this lab we learnt time reversal, flipping, time scaling and even and odd signals. Made
and plotted signals in Matlab and expand, compressed the signals and explored various
commands. Learnt the behaviour of signals.

You might also like