You are on page 1of 8

ADSP LAB, First Year M. Tech.

E&TC

Name: Ghanshyam Patankar Date of Submission: 23-02-2021


ID: 202151015
Experiment 2

Title: Operations on Signals

Aim: To perform time shifting, time scaling and reversal of given signals
1) x(-2n+2)
2) x((-n/2)-2)
Software: MATLAB
(Online Matlab Simulator)
Theory:
1. Time Shifting
Suppose that we have a signal x(t) and we define a new signal by adding/subtracting a
finite time value to/from it. We now have a new signal, y(t). The mathematical expression for
this would be x(t ± t0).

Graphically, this kind of signal operation results in a positive or negative “shift” of the signal
along its time axis and while doing so, none of its characteristics are altered. The time-
shifting operation results in the change of just the positioning of the signal without affecting
its amplitude or span.

a) Time-Delayed Signals

Figure 1. Original signal and its time-delayed version


y[n] = x[n-3]

1
ADSP LAB, First Year M. Tech. E&TC

b) Time-Advanced Signals

Figure 2. Original signal and its time-advanced version


y[n] = x[n+2]

2. Time Scaling
If we multiply the time variable by a factor of 2, then we will get our output signal contracted
by a factor of 2 along the time axis. Thus, it can be concluded that the multiplication of the
signal by a factor of n leads to the compression of the signal by an equivalent factor.

Figure 3. Original signal with its time-scaled versions

2
ADSP LAB, First Year M. Tech. E&TC

3. Time Reversal
Until now, we have assumed our independent variable representing the signal to be positive.
It can be negative. In fact, one can make it negative just by multiplying it by -1. This causes
the original signal to flip along its y-axis. That is, it results in the reflection of the signal
along its vertical axis of reference. As a result, the operation is aptly known as the time
reversal or time reflection of the signal.

Figure 4. A signal with its reflection

Here you can observe that the value of x[n] at the time instant n = -2 is -1. This is equal to the
value of y[n] at n = 2. Likewise, x[-0.5] = y[0.5] = -1, x[1] = y[-1] = 1, and x[4] = y[-4] = 4.
This indicates that the graph of y[n] is nothing but the original signal x[n] reflected along the
vertical axis.
This applies to both continuous- and discrete-time signals.

Program/Code:
I. Time Shifting
%Shifting on first signal
clc;
clear all;
close all;
n1=input('Enter the amount to be delayed');
n2=input('Enter the amount to be advanced');
n=-2:2;
x=(-2*n+2);
subplot(3,1 ,1);
stem(n,x);
title('signal x(n)');

3
ADSP LAB, First Year M. Tech. E&TC

m=n+n1;
y=x;
subplot(3,1,2);
stem(m,y);
title('Delayed signal x(n-n1)');
t=n-n2;
z=x;
subplot(3,1,3);
stem(t,z);
title('Advanced signal x(n+n2)');

%Shifting on second signal


clc;
clear all;
close all;
n1=input('Enter the amount to be delayed');
n2=input('Enter the amount to be advanced');
n=-2:2;
x=((-n/2)-2);
subplot(3,1 ,1);
stem(n,x);
title('signal x(n)');
m=n+n1;
y=x;
subplot(3,1,2);
stem(m,y);
title('Delayed signal x(n-n1)');
t=n-n2;
z=x;
subplot(3,1,3);
stem(t,z);
title('Advanced signal x(n+n2)');

II. Time Scaling

clc;
clear all;
close all;
n=[-3:3];
%first signal
x=((-2*n)+2);
subplot(2,4,1)
stem(n,x);
xlim([-6 6])
title('x1(n)')
%time scaling
subplot(2,4,2);
stem(n*2,x);
xlim([-8 8])

4
ADSP LAB, First Year M. Tech. E&TC

title('Time scaling- expansion of x1(n)')


%second signal
a=(((-n)/2)-2);
subplot(2,4,3)
stem(n,a);
xlim([-6 6])
title('x2(n)')
%time scaling
subplot(2,4,4);
stem(n*2,a);
xlim([-8 8])
title('Time scaling- expansion of x2(n)')

III. Time Reversal

Reversing first signal:


clc;
clear all;
close all;
n=-1:2;
x=(2*n+2);
subplot(2,1,1);
stem(n,x);
axis([-3 3 -5 5]);
title('Signal x(n)');
c=fliplr(x);
y=fliplr(-n);
subplot(2,1,2);
stem(y,c);
axis([-3 3 -5 5]);
title('Reversed Signal x(-n)');

Reversing second signal:


clc;
clear all;
close all;
n=-1:2;
x=((-n/2)-2);
subplot(2,1,1);
stem(n,x);
axis([-3 3 -5 5]);
title('Signal x(n)');
c=fliplr(x);
y=fliplr(-n);
subplot(2,1,2);
stem(y,c);
axis([-3 3 -5 5]);
title('Reversed Signal x(-n)');

5
ADSP LAB, First Year M. Tech. E&TC

Output:
I. Output of Time Shifting

i) Shifted output of 1st signal

ii) Shifted output of 2nd signal

6
ADSP LAB, First Year M. Tech. E&TC

II. Output of Time Scaling

III. Output of Time Reversal

iii) Reversed form of 1st signal

iv) Reversed form of 2nd signal

7
ADSP LAB, First Year M. Tech. E&TC

Conclusion:

We have learned the basic operations on various signals. By analyzing the obtained
plots/figures we practically learned the significance of these operations. Hence we have
successfully performed time shifting, time scaling & time reversing operation on the given
signals.

You might also like