Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Faculty Member: Sikandar Hayat Dated: 01-April-2017

Course/Section: BEE-7A Semester: 4th

Name: TALHA IRFAN

EE-232 Signals and Systems


Lab - 05
Introduction to Properties of Systems
Lab5: Introduction to Properties of
Systems

Lab Instructions
This lab activity comprises of three parts: Pre-lab, Lab Exercises, and Post-Lab Viva
session.
Only those tasks that completed during the allocated lab time will be credited to the
students. Students are however encouraged to practice on their own in spare time for
enhancing their skills.

Lab Report Instructions


All questions should be answered precisely to get maximum credit. Lab
report must ensure following items:
Lab objectives
Matlab codes
Results (graphs/tables) duly commented and discussed
Conclusion
Introduction to Systems
1.1Pre-Lab
1.1.1 Introduction
Systems can be classified into different categories based upon certain properties. Generally, it
is easier to identify a case or input for which a particular property does not hold. For the
remainder of this exercise please keep this point in mind. The first section covers
memory/memory-less systems, causal/non-causal systems, time varying/time-invariant
systems and linear and non-linear systems.

1.1.2 Memory / Memory-less Systems


A system is memory-less if output of each value of independent variable is dependnet only on
the input at that same time.
y[n] = x[n] (Memory-less System)
y[n] = x[n] x[n-1] (System with Memory)

1.1.3 Causal / Non-causal Systems


A system is causal if it does not depend on future values of input to determine the output. If a
system output y(t) depends only on the input at present or earlier times, we say that the
system is causal. Another way to say this is that the output does not anticipate future values of
the input. All memoryless systems are causal. A noncausal system anticipates the future
values of the input signal in some way.

y[n] = x[n] - x[n-1] (Causal System)


y[n] = x[n] x[n+1] (Non/Anti-Causal System)

1.1.4 Time varying / Invariant Systems


If a shifted input produces an output that is identically shifted then the system is a time
invariant system.

y[n-N] = x[n-N] (Time Invariant System)


y[n] = (0.5)n+1 x3[n-1] (Time Varying System)

if then
1.1.5 Linear / Non-linear Systems
Linear systems adhere to the principle of superposition. Superposition, comprises of
additivity and homogeneity.

Additivity if x1[n] y [n] & x [n] y [n] then x1[n]+x2[n]


1 2 2

y [n]+y [n]
1 2

Homogeneity if x[n] y[n] then ax[n]


ay[n]

1.1.6 Lab task 1:


a. Verify that the system y[n] = sin ((/2)x[n]) is not linear. Use signal x1[n] = [n] and
x2[n] = 2[n] to demonstrate if the system violates linearity.
CODE
n = [-5:5];
x1 = [0 0 0 0 0 1 0 0 0 0 0]; %Delta Function is 1 at index 0, ZERO
otherwise.
x2 = [0 0 0 0 0 2 0 0 0 0 0];
f1 = sin((pi/2)*x1);
f2 = sin((pi/2)*x2);
figure(1)% The function Figure(h) makes the figure identified
by h the current figure, makes it visible, and raises it above all
other figures on the screen.
subplot(4,1,1),stem(n,x1,'filled')
title('x1[n]')
subplot(4,1,2),stem(n,f1,'filled')
title('y[n]')
subplot(4,1,3),stem(n,x2,'filled')
title('x2[n]')
subplot(4,1,4),stem(n,f2,'filled')
title('y[n]')

% the last 8 commands plot delta and sinusoidal functions on a single


screen.

OUTPUT
Scaling the input does not scale the output by the same degree, hence the
system is not linear.

b. Verify if the following system y[n] = x[n] + x[n+1] is not causal. Use the signal
x[n]=u[n] to deomstrate this. Define vectors x and y to represent the input on the
interval -5 n 9 and output on the interval -5 n 8.

CODE
n = [-5:9]; %Input x-axis scale.
u1 = [ 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1]; %The standard unit response.
u2 = [0 0 0 0 1 1 1 1 1 1 1 1 1 1 0]; %Unit response shifted by 1
unit to the left.
y = u1 + u2;
figure(1) % The function figure(h) makes the figure identified
by h the current figure, makes it visible, and raises it above all
other figures on the screen.
subplot(3,1,1),stem(n, u1 , 'filled')
title('x[n]')
subplot(3,1,2),stem(n, u2 , 'filled')
title('x[n+1]')
subplot(3,1,3),stem(n, y , 'filled')
title('y[n]')
%The last commands plot the discrete-time graphs in a single-plot.
OUTPUT

It can be seen that the system is not causal because at any value of n, we
need to know the input at the next value. For example y[5] = x[5] + x[6],
depends on future values.

c. Verify if the following system y[n] = x[2n] is time variant or invariant? Use a
signal of your choice.

CODE
r0 = [-6:6]; %The selected range.
i1 = [0, 0, 0, 0, 0, 0,1,1,1,1,1,1,1] %The input function.
r1 = [-3:3];%y = x[2*n], compresses the range of n by half.
i2 = [0,0,0,1,1,1,1] %The compressed input values (-3 to 3).
i3 = [0,0,1,1,1,1,0] %The input for y[n] = x[n] for comparison.
y = h; %Output for y[n] = x[n], comparator.
subplot(4,1,1), stem(r0,i1,'filled')
subplot(4,1,2), stem(r1,i2,'filled')
subplot(4,1,3),stem(r1,i3,'filled')
subplot(4,1,4),stem(r1,y,'filled')

OUTPUT

1.2Pre-Lab
Convolution is the process by which the output of a linear time invariant
system can be determined to a specific input signal. We shall cover
convolution in detail in the next lab. However, in this lab we shall only use
the convolution function provided in MATLAB. Use the convolution function
conv or convn to verify the following properties of systems.

x[n] * y[n] = y[n] * x[n] (Commutative


Property)

(x[n] *h1[n])* h2[n] = (h1[n]* h2[n])*x[n] (Associative


Property)

1.2.1 Lab task 2:

d. Given the signals x[n] = [1 2 3 4 5] and y[n] = [1 1 1 1 1], verify using conv or
convn function that commutative property holds.

CODE
x = [1 2 3 4 5];
y = [1 1 1 1 1];
z = conv(x,y);
g = conv(y,x);
n2 = [-4:4]
subplot(2,1,1),stem(n2,z,'filled')
xlabel('h')
ylabel('z')
grid
subplot(2,1,2),stem(n2,g,'filled')
xlabel('h')
ylabel('g')
grid

OUTPUT

SINCE THE OUTPUTS ARE SAME, THIS PROVES THE COMMUTATIVE


PROPERTY.

e. Assume a 2-D signal (i.e., some image). Load image and assume it to be signal x.
Next assume that instead of having a 2-D filter you have two one D filters h 1[n]
=[0.25 0.5 0.25] and h2[n]=[0.25;0.5;0.25]. Assume that the convolution (h1[n]*
h2[n]) = h3[n] = [0.0625 0.125 0.0625; 0.125 0.25 0.125; 0.0625
0.125 0.0625]. Using this information and output at each stage
verify that Associative property holds.

CODE

x = imread('image.jpg'); %Inputs the image.

h1 = [0.25 0.5 0.25];

h2 = [0.25;0.5;0.25];

h3 = convn(h1,h2);

y = convn(x,h1);

output1 = convn(y,h2);

output2 = convn(h3,x);

subplot(211),imagesc(output1);

title('Graph of (x[n]*h1[n])*h2[n]');

subplot(212),imagesc(output2);

title('Graph of (h1[n]*h2[n])*x[n]) %Checking the associative


property.
The algorithm is alright but due to some small errors, the output
does not appear.noteno

You might also like