You are on page 1of 3

Experiment No: 3

Checking Linearity of a system for Discrete input

Objective :

To check the linearity of a signal for a discrete input using MATLAB.

Software :

MATLAB/SIMULINK

Theory:

Digital signals are discrete in both time (the independent variable) and amplitude
(the dependent variable). Signals that are discrete in time but continuous in
amplitude are referred to as discrete-time signals.

Linearity: A linear system is one which obeys the superposition principle. For a
certain system, let the outputs corresponding to inputs x 1[n] and x2[n] are y1[n] and
y2[n] respectively. Now if the input is given by

x[n] = Ax1[n] + Bx2[n]

where A and B are arbitrary constants, then the system is linear if its corresponding
output is

y[n] = Ay1[n] + By2[n]

Superposition is a very nice property which makes analysis much simpler. Although
many real systems are not entirely linear throughout its operating region (for
instance, the bipolar transistor), they can be considered approximately linear for
certain input ranges. Linearization is a very useful approach to analyzing nonlinear
systems.

Procedure:

Open New Script file with and extension .m in MATLAB.


As per the theory mentioned above, write the code for realizing above said
signals and check its linearity using MATLAB commands.
Use a function file to input the function for which you want to check linearity.
Save the script file and execute the file to obtain results.
MATLAB Commands:

clc
clear;
n=10;
a=2;
b=4;
s=@(x)a*x.^b;
x1=2:10;
x2=12:20;
cond1=s(x1)+s(x2)
cond2=s(x1+x2)
if cond1==cond2
disp('result of super position')
else
disp('result of not superposition')
end
if s(n*(x1))==n*(x1)
disp('result of homogenity')
else
disp('not homogenity')
end
subplot(2,2,1);
stem(x1)
subplot(2,2,2);
stem(x2)
subplot(2,2,3);
stem(s(x1)+s(x2))
subplot(2,2,4);
stem(s(x1+x2))

Graphical Output :
Output

The following output is observed in the command window of MATLAB.

The system does not satisfy Superposition The system is Non-Homogenous So the
System is Non-Linear

Result

The given system is analyzed for its Linearity using MATLAB and the result is
presented.

You might also like