EXPERIMENT NUMBER 5
STUDY OF SYSTEM USING MATLAB
5.1 OBJECTIVE
Some basic objectives of this lab are listed below:
Observing behavior of system for a particular signal.
The main objective of this lab is to defining and understanding different type of
signals that are most commonly used in signal and system.
Plotting of some basic signal so we can understand it easily.
5.2INTRODUCTION
In this lab we have seen different type of system including:
Causal Non-Causal
Static Dynamic
Linear Non-Linear
Time Variant Time Invariant
Invertible Non-Invertible
Now we will discuss some of these signals in details.
5.2.1 Causal and Non Causal
A system is said to be causal if its output depends upon present and past
inputs, and does not depend upon future input.
For Non-Causal system, the output depends upon future inputs.
Examples: The output of casual system depends on present and past inputs, it means
y(n) is a function of x(n), x(n-1), x(n-2), x(n-3) etc. Some examples of causal systems
are given below:
1) y(n) = x(n) + x(n-2)
2) y(n) = x(n-1) – x(n-3)
3) y(n) = 7x(n-5)
Significance of causal systems:
Since causal system does not include future input samples; such system is
practically realizable. That mean such system can be implemented practically.
Generally, all real time systems are causal systems; because in real time applications
only present and past samples are present. Since future samples are not present; causal
system is memory less system.
A system whose present response depends on future values of the inputs is
called as a non-causal system.
Examples: In this case, output y(n) is function of x(n), x(n-1), x(n-2) etc. as well as it
is function of x(n+1), x(n+2), x(n+3), … etc. following are some examples of non-
causal systems:
1) Y(n) = x(n) + x(n+1)
2) Y(n) = 7x(n+2)
3) Y(n) = x(n) + 9x(n+5)
5.2.2 Static and Dynamic
Static system is a system in which output at any instant of time depends on
input sample at the same time.
Example:
1) y(n) = 9x(n)
In this example 9 is constant which multiplies input x(n). But output at nth instant that
means y(n) depends on the input at the same (nth) time instant x(n). So this is static
system.
2) y(n) = x2(n) + 8x(n) + 17
Here also output at nth instant, y(n) depends on the input at nth instant. So this is
static system.
Why static systems are memory less systems?
Observe the input output relations of static system. Output does not depend on
delayed [x(n-k)] or advanced [x(n+k)] input signals. It only depends on present input
(nth) input signal. If output depends upon delayed input signals, then such signals
should be stored in memory to calculate the output at nth instant. This is not required
in static systems. Thus for static systems, memory is not required. Therefore, static
systems are memory less systems.
Dynamic system is a system in which output at any instant of time depends on
input sample at the same time as well as at other times.
Here is some important point.
All static systems are causals.
All causals are not static.
All non-causal are dynamic.
All dynamics are not non-causal
5.2.3 Linear and Non-Linear
A linear system is a system which follows the superposition principle. A
system is said to be linear if the combined response of a1x1(n) and a2x2(n) is equal to
the addition of the individual responses.
That means,
T[a1 x1(n) + a2 x2(n)] = a1 T[x1(n)] + a2 T[x2(n)
The above theorem is also known as superposition theorem.
Linear system has one important characteristic: If the input to the system is
zero then it produces zero output. If the given system produces some output (non-
zero) at zero input then the system is said to be Non-linear system. If this condition is
satisfied then apply the superposition theorem to determine whether the given system
is linear or not?
5.2.4 Time Variant and In-Variant
A system is said to be Time Invariant if its input output characteristics do not
change with time. Otherwise it is said to be Time Variant system.
Input ------------------------------------ Replace
Output-----------------------------------Delay
5.2.5 Invertible and Non-Invertible
To define stability of a system we will use the term ‘BIBO’. It stands for
Bounded Input Bounded Output. The meaning of word ‘bounded’ is some finite
value. So bounded input means input signal is having some finite value. i.e. input
signal is not infinite. Similarly bounded output means, the output signal attains some
finite value i.e. the output is not reaching to infinite level.
An infinite system is BIBO stable if and only if every bounded input produces
bounded output.
Mathematical representation:
Let us consider some finite number Mx whose value is less than infinite. That means
Mx < 8, so it’s a finite value. Then if input is bounded, we can write,
|x(n)| = Mx < 8
Similarly for C.T. system
|x(t)| = Mx < 8
Similarly consider some finite number My whose value is less than infinity. That
means My < 8, so it’s a finite value. Then if output is bounded, we can write,
|y(n)| = My < 8
Similarly for continuous time system
|y(t)| = My < 8
5.3IN-LAB TASKS
5.3.1 TASK1: If Relation between Input and Output is y[n]=x[-n] then check whether
the function {
x [n]= 2 n ,−2 ≤ n ≤2 is
0 else
a) Static and Dynamic
b) Causal and Non Causal
n=-2:2;
x=2.*n;
subplot(2,1,1)
stem(n,x,'fill'),grid on
title('Graph of Input x[n]') This is a Dynamic Function because in this
legend('x[n]') function memory is included.
xlabel('Time n') AND
ylabel('x[n]')
axis([-3,3,-5,5])
Also It is non-Causal because it depend on
subplot(2,1,2) the future.
stem(n,-x,'fill'),grid on
title('Graph of Output y[n]')
legend('x[-n]')
xlabel('Time n')
ylabel('x[-n]')
axis([-3,3,-5,5])
Graph of Input x[n]
5
x[n]
x[n]
-5
-3 -2 -1 0 1 2 3
Time n
Graph of Output y[n]
5
x[-n]
x[-n]
-5
-3 -2 -1 0 1 2 3
Time n
c) Linear and Non Linear if
{
x1[n]=
2 n ,−2 ≤n ≤ 4
0 else
and x2[n]= {n/3 ,−2 ≤n≤4
0 else
given that a=2
and b=3
n=-2:4;
x1=2.*n;
x2=n/3;
s=6;
a=2;
b=3;
y1=s.*(a.*x1+b.*x2);
y2=s.*a.*x1+s.*b.*x2;
subplot(2,1,1)
stem(-n,y1,'linewidth',2.5),grid on
title('Graph of Output y1[-n]')
legend('y1[-n]')
xlabel('Time n')
ylabel('y1[-n]')
axis([-5,3,-150,250])
subplot(2,1,2)
stem(-n,y2,'linewidth',2.5),grid on
title('Graph of Output y2[n]')
legend('y2[-n]')
xlabel('Time n')
ylabel('y2[-n]')
axis([-5,3,-150,250])
if(y1==y2)
disp('Linear')
else
disp('Non-Linear')
end
Graph of Output y1[-n]
200 y1[-n]
100
y1[-n]
-100
-5 -4 -3 -2 -1 0 1 2 3
Time n
Graph of Output y2[n]
200 y2[-n]
100
y2[-n]
-100
-5 -4 -3 -2 -1 0 1 2 3
Time n
d) Time variant and Invariant for x1[n] and shift n0 =3
n=-2:4;
n0=3;
x=2.*n;
y1=2.*(n-n0);%input replace
y2=2.*n-n0;%output delay
subplot(2,1,1)
stem(-n,y1,'linewidth',2.5),grid on
title('Graph of Output y1[-n]')
legend('y1[-n]')
xlabel('Time n')
ylabel('y1[-n]')
axis([-5,3,-11,6])
subplot(2,1,2)
stem(-n,y2,'linewidth',2.5),grid on
title('Graph of Output y2[-n]')
legend('y2[-n]')
xlabel('Time n')
ylabel('y2[-n]')
axis([-5,3,-11,6])
if(y1==y2)
disp('time invariant')
else
disp('time variant')
end
Graph of Output y1[-n]
5
y1[-n]
0
y1[-n]
-5
-10
-5 -4 -3 -2 -1 0 1 2 3
Time n
Graph of Output y2[-n]
5
y2[-n]
0
y2[-n]
-5
-10
-5 -4 -3 -2 -1 0 1 2 3
Time n
5.4POST LAB TASKS
5.4.1 TASK1: If Relation between Input and Output is y[n]=x[1-2n] then check
whether the function {
x [n]= 2 n ,−2 ≤ n ≤2 is
0 else
Static and Dynamic
Causal and Non Causal
n=-2:2;
x=2.*n;
subplot(2,1,1)
stem(n,x,'fill'),grid on
title('Graph of Input x[n]') This is a Dynamic Function because in this
legend('x[n]') function memory is included.
xlabel('Time n') AND
ylabel('x[n]')
axis([-3,3,-6,6])
Also It is non-Causal because it depend on
subplot(2,1,2) the future.
stem((1-n)/2,x,'fill'),grid on
title('Graph of Output y[n]')
legend('x[-n]')
xlabel('Time n')
ylabel('x[-n]')
axis([-1,2,-6,6])
Graph of Input x[n]
5
x[n]
x[n]
-5
-3 -2 -1 0 1 2 3
Time n
Graph of Output y[n]
5
x[-n]
x[-n]
-5
-1 -0.5 0 0.5 1 1.5 2
Time n
Linear and Non Linear if
{
x1[n]=
2 n ,−2 ≤n ≤ 4
0 else
and x2[n]= {n/3 ,−2 ≤n≤4
0 else
given that a=2
and b=3
n=-2:4;
x1=2.*n;
x2=n/3;
s=6;
a=2;
b=3;
y1=s.*(a.*x1+b.*x2);
y2=s.*a.*x1+s.*b.*x2;
subplot(2,1,1)
stem((1-n)/2,y1,'linewidth',2.5),grid on
title('Graph of Output y1[-n]')
legend('y1[1-2n]')
xlabel('Time n')
ylabel('y1[1-2n]')
axis([-2,2,-150,250])
subplot(2,1,2)
stem((1-n)/2,y2,'linewidth',2.5),grid on
title('Graph of Output y2[n]')
legend('y2[1-2n]')
xlabel('Time n')
ylabel('y2[1-2n]')
axis([-2,2,-150,250])
if(y1==y2)
disp('Linear')
else
disp('Non-Linear')
end
Graph of Output y1[-n]
200 y1[1-2n]
100
y1[1-2n]
-100
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Time n
Graph of Output y2[n]
200 y2[1-2n]
100
y2[1-2n]
-100
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Time n
Time variant and Invariant for x1[n] and shift n0 =3
n=-2:4;
n0=3;
x=2.*n;
y1=2.*(n-n0);%input replace
y2=2.*n-n0;%output delay
subplot(2,1,1)
stem((1-n)/2,y1,'linewidth',2.5),grid on
title('Graph of Output y1[-n]')
legend('y1[1-2n]')
xlabel('Time n')
ylabel('y1[1-2n]')
axis([-2,2,-11,6])
subplot(2,1,2)
stem((1-n)/2,y2,'linewidth',2.5),grid on
title('Graph of Output y2[1-2n]')
legend('y2[1-2n]')
xlabel('Time n')
ylabel('y2[1-2n]')
axis([-2,2,-11,6])
if(y1==y2)
disp('time invariant')
else
disp('time variant')
end
Graph of Output y1[-n]
5
y1[1-2n]
0
y1[1-2n]
-5
-10
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Time n
Graph of Output y2[1-2n]
5
y2[1-2n]
0
y2[1-2n]
-5
-10
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Time n