% FOR TIME VARITANT OR INVARIANT
clc
clear all
close all
t=-5:0.001:5
l=length(t)
for i=1:l
if t(i)>=0
x1(i)=1;
else x1(i)=0;
end
end
x2=cos(pi*t)
x3=cos(pi*(t-2))
y1=x1.*x2
y2=x1.*x3
subplot(4,1,1)
plot(t,x1)
xlabel('t')
ylabel('x1')
title('for x1')
grid on
gtext('1841014009')
subplot(4,1,2)
plot(t,y1)
xlabel('t')
ylabel('y1')
title('for y1')
grid on
gtext('1841014009')
subplot(4,1,3)
plot(t,x2)
xlabel('t')
ylabel('x2')
title('for x2')
grid on
gtext('1841014009')
subplot(4,1,4)
plot(t,y2)
xlabel('t')
ylabel('y2')
title('for y2')
grid on
gtext('1841014009')
if round(y1)==round(y2)
disp('time invariant');text(-2,-0.5, ('System Is Time Invariant'));
else disp('time variant');text(-2,-0.5, ('System Is Time Variant'))
end
% FOR LINEARITY TEST
clc
clear all
close all
t=-4:0.001:5
l=length(t)
for i=1:l
if t(i)>=0
x1(i)=1;
else x1(i)=0;
end
end
for i=1:l
if t(i)>=1
x2(i)=1;
else x2(i)=0;
end
end
a1=2
a2=3
y1=a1.*x1.*cos(pi*t)
y2=a2.*x2.*cos(pi*(t-1))
y=((a1.*x1)+(a2.*x2)).*cos(pi*t)
y3=y1+y2;
subplot(4,1,1)
plot(t,y)
title('for y')
xlabel('t')
ylabel('y')
grid on
gtext('1841014009')
subplot(4,1,2)
plot(t,y1)
title('for y1')
xlabel('t')
ylabel('y1')
grid on
gtext('1841014009')
subplot(4,1,3)
plot(t,y2)
title('for y2')
xlabel('t')
ylabel('y2')
grid on
gtext('1841014009')
subplot(4,1,4)
plot(t,y3)
title('for y3')
xlabel('t')
ylabel('y3')
grid on
gtext('1841014009')
if round(y)==round(y3)
disp('system is linear');
text(-2,-0.5, ('System Is Linear'));
else disp('system is non linear');
text(-2,-0.5, ('System Is Non-Linear'));
end
% FOR STABILITY TEST
clc
clear all
close all
t=0:0.01:10
l=length(t)
for i=1:l
if t(i)>=0
x(i)=1;
else x(i)=0;
end
end
y=exp(-2*t).*x
c=0
for i=1:l-1
if (y(i)>y(i+1))
c=c+1;
end
end
subplot(2,1,1)
plot(t,x)
title('for x')
xlabel('t')
ylabel('x')
grid on
gtext('1841014009')
subplot(2,1,2)
plot(t,y)
title('for y')
xlabel('t')
ylabel('y')
grid on
gtext('1841014009')
if(c~=0)
disp('system is stable');
text(2,0.5, ('System Is Stable'));
else
disp('system is unstable');
text(2,0.5, ('System Is Untable'));
end