Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

%Time reversal (or) folding operation on Unit step function

cc

t = -3:0.001:3;

x = zeros(1,length(t));
for i = 1:length(t);
if t(i)>=0
x(i) = 1;
else
x(i) = 0;
end
end

x1 = zeros(1,length(t));
for i = 1:length(t);
if t(i)<=0
x1(i) = 1;
else
x1(i) = 0;
end
end

subplot(2,1,1)
plot(t,x)
grid
xlabel('Time - t')
ylabel('amplitude')
title('unit step signal u(t) - 21075A1008')
axis([-3.5 3.5 -1.2 1.2])

subplot(2,1,2)
plot(t,x1)
grid
xlabel('Time - t')
ylabel('amplitude')
title('Folded unitstep signal -u(t) - 21075A1008')
axis([-3.5 3.5 -1.2 1.2])

1
Published with MATLAB® R2020a

You might also like