EXPERIMENT No-7(a)
LINEARITY OF A DISCRETE SYSTEM
AIM:
Verify the Linearity of a given Discrete System.
Software Required:
Mat lab software 7.0 and above
Theory:
LINEARITY PROPERTY:
Any system is said to be linear if it satisfies the superposition principal, superposition
principal state that Response to a weighted sum of input signal equal to the corresponding
weighted sum of the outputs of the system to each of the individual input signals.
T [a ¿ ¿ 1 x1 ( n ) +a 2 x 2 ( n ) ]=a1 T [ x 1 ( n ) ] +a 2 T [ x 2 ( n ) ] ¿
X(n) --------------input signal
Y(n)--------------output signal
Y(n)=T[x(n)]
Yl(n)=T[XI(n)]: Y2(n)-T[X2(n)]
x3=[a X1(n)] + [X2(n)] +b[X2(n)]
Y3(n)=T [x3(n)] =
T [a X1(n)] +b [X2(n)]=a Yl(n)+ b [Y]
Let a [Y](n)] +b [X2(n)] =z3(n)
Program:
clc; %Clear command window
clear all; %Clear all variables
close all; %Close all figure windows
%entering two input sequences and impulse sequence
x1=input('Type the samples of x1'); %User defined samples of x1
x2=input('Type the samples of x2'); %User defined samples of x2
if(length(x1)~=length(x2)) %Checks if lengths of x1 and x2
are not equal
disp('error:lengths of x1 and x2 are different'); %Displays error if the lengths of
x1 and x2 are different
return; %Returns lengths of x1 and x2
end; %End the program
h=input('Type the samples of h'); %User defined samples of h
%length of output sequences
N=length(x1)+length(h)-1; %Assigning N value
disp('Length of output signal will be'); %Display the statement
disp(N); %Display the value of N
%entering scaling factors
a1=input('The scale factor a1 is'); %User defined scale factor a1
a2=input('The scale factor a2 is'); %User defined scale factor a2
x=a1*x1+a2*x2; %Assigning x value
%response of x and x1
y01=conv(x,h); %Convolution between x and h
y1=conv(x1,h); %Convolution between x1 and h
%scaled response of x1
y1s=a1*y1; %Assigning y1s value
%response of x2
y2=conv(x2,h); %Convolution between x2 and h
%scaled response of x2
y2s=a2*y2; %Assigning y2s value
y02=y1s+y2s; %Assigning y02 value
disp('Input signal x1 is');disp(x1); %Display input signal x1
disp('Input signal x2 is');disp(x2); %Display input signal x2
disp('Output sequence y01 is');disp(y01); %Display output sequence y01
disp('Output sequence y02 is');disp(y02); %Display output sequence y02
if(y01==y02) %Checks if y01 and y02 are equal
disp('y01=y02. Hence the LTI system is LINEAR'); %Display the statement if y01 and
y02 are equal
end; %End the program
OUTPUT:
Type the samples of x1
[2 6 7 3]
Type the samples of x2
[9 4 6 2]
Type the samples of h
[2 4 6 8]
Length of output signal will be
7
The scale factor a1 is
2
The scale factor a2 is
4
Input signal x1 is
2 6 7 3
Input signal x2 is
9 4 6 2
Output sequence y01 is
80 216 428 668 508 388 112
Output sequence y02 is
80 216 428 668 508 388 112
y01=y02. Hence the LTI system is LINEAR
RESULT:
The linearity of a given Discrete System is verified.