Time delay and time advance of a sequence in MATLAB
%Code
for right shift:
n1=input('Enter the required amount of shift');
n=-3:3;
x=[-2
0 1 -3 2 -1 3];
subplot(2,1,1);
stem(n,x);
xlabel('Time sample');
ylabel('Amplitude');
title('Original Signal');
m=n+n1;
subplot(2,1,2);
stem(m,x);
xlabel('Time sample');
ylabel('Amplitude');
title('Advanced signal')
%Code
for left shift:
n1=input('Enter the required amount of shift');
n=-3:3;
x=[-2
0 1 -3 2 -1 3];
subplot(2,1,1);
stem(n,x);
xlabel('Time sample');
ylabel('Amplitude');
title('Original Signal');
m=n-n1;
subplot(2,1,2);
stem(m,x);
xlabel('Time sample');
ylabel('Amplitude');
title('Advanced signal');
No comments