LINEARITY PROPERTY:
If any system is claimed to be linear if it satisfies the superposition principal. Superposition principal state that Response to a weighted sum of input adequate to the corresponding weighted sum of the outputs of the system to every of the individual input signals.
If x(n) may be a input and y(n) may be a output then
y(n)=T[x(n)]
y1(n) =T[x1(n)] and y2(n)=T[x2(n)]
x3 =[a*x1(n) +b *x2(n) ]
Y3(n) = T [x3(n)]
T [a*x1(n) + b*x2(n)] = a y1(n) + b y2(n)
Program:
clc;
close all;
clear all;
% Verification of Linearity of a given System.
% a) y(n)=nx(n) b) y=x^2(n)
n=0:40;
a1=input(‘enter the scaling factor a1=’);
a2=input(‘enter the scaling factor a2=’);
x1=cos(2*pi*0.1*n);
x2=cos(2*pi*0.4*n);
x3=a1*x1+a2*x2;
%y(n)=n.x(n);
y1=n.*x1;
y2=n.*x2;
y3=n.*x3;
yt=a1*y1+a2*y2;
yt=round(yt);
y3=round(y3);
if y3==yt
disp(‘given system [y(n)=n.x(n)]is Linear’);
else
disp(‘given system [y(n)=n.x(n)]is non Linear’);
end
%y(n)=x(n).^2
x1=[1 2 3 4 5];
x2=[1 4 7 6 4];
x3=a1*x1+a2*x2;
y1=x1.^2;
y2=x2.^2;
y3=x3.^2;
yt=a1*y1+a2*y2;
if y3==yt
disp(‘given system [y(n)=x(n).^2 ]is Linear’);
else
disp(‘given system is [y(n)=x(n).^2 ]non Linear’);
end
Output will obtained as
Enter the scaling factor a1=3
Enter the scaling factor a2=5
Given system [y(n) =n.x(n)]is Linear
Given system is [y(n) =x(n).^2 ]non Linear
Time-Invariant System:
A system is named time-invariant if its input-output characteristics don’t change with time. X(t) is the input and Y(t) will be the output, X(t-k) is a delayed form of input by k seconds, Y(t-k) is delayed form of output by k seconds.
If Y(t)=T[X(t)] while Y(t-k)=T[X(t-k)] then system is time invariant system.
clc;
close all;
clear all;
% Verification of your Time Invariance of a Discrete System
% a)y=x^2(n) b) y(n)=nx(n)
clc;
clear all;
close all;
n=1:9;
x(n)=[2 1 4 3 6 5 8 7 9];
d=3; % some time delay
xd=[zeros(1,d),x(n)];%x(n-k)
y(n)=x(n).^2;
yd=[zeros(1,d),y];%y(n-k)
disp(‘transformation of delay signal yd:’);
disp(yd)
dy=xd.^2; % T[x(n-k)]
disp(‘delay of transformation signal dy:’);
disp(dy)
if dy==yd
disp(‘given system [y(n)=x(n).^2 ]is time invariant’);
else
disp(‘given system is [y(n)=x(n).^2 ]not time invariant’);
end
y=n.*x;
yd=[zeros(1,d),y(n)];
disp(‘transformation of delay signal yd:’);disp(yd);
n1=1:length(xd);
dy=n1.*xd;
disp(‘delay of transformation signal dy:’);disp(dy);
if yd==dy
disp(‘given system [y(n)=nx(n)]is a time invariant’);
else
disp(‘given system [y(n)=nx(n)]not a time invariant’);
end
Output:
Transformation of delay signal yd:
0 0 0 4 1 16 9 36 25 64 49 81
Delay of transformation signal dy:
0 0 0 4 1 16 9 36 25 64 49 81
Given system [y(n)=x(n).^2 ]is time invariant
Transformation of delay signal yd:
0 0 0 2 2 12 12 30 30 56 56 81
Delay of transformation signal dy:
0 0 0 8 5 24 21 48 45 80 77 108
Given system [y(n)=nx(n)]not a time invariant