0% found this document useful (0 votes)
16 views10 pages

S S.Lab.5

Uploaded by

Usama Javed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views10 pages

S S.Lab.5

Uploaded by

Usama Javed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

EXPERIMENT NO.

OBJECTIVE:

To learn how to perform signal manipulation in discrete time domain.

LEARNING OUTCOMES:

In this lab, you will be able to understand the following points:


 Time Shifting.
 Time Scaling.
 Folding.

THEORY:

We categorized the basic signal operations into two types depending on whether they
operated on dependent or independent variable(s) representing the signals. Addition,
subtraction, multiplication, differentiation, and integration fall under the category of basic
signal operations acting on the dependent variable, which we have already covered in the
previous lab. Now, in this lab, we will concentrate on the basic signal operations which
manipulate the signal characteristics by acting on the independent variable(s) which are used
to represent them. This means that instead of performing operations like addition, subtraction,
and multiplication between signals, we will perform them on the independent variable. In our
case, this variable is time (t).

1. MANIPULATION IN TIME DISCRETE DOMAIN:


Simple manipulation on time axis of discrete signals include
1. Time shifting
2. Folding
3. Time scaling

1.1. TIME SHIFTING:


Time shifting is, as the name suggests, the shifting of a signal in time. This is done by adding
or subtracting the amount of the shift to the time variable in the function. Subtracting a fixed
amount from the time variable will shift the signal to the right (delay) that amount while
adding to the time variable will shift the signal to the left (advance). So time shift delay or
advances the signal in time by a time interval +t 0 or –t 0, without changing its shape.

Time shift occur when we replace ‘n’ by ‘(n-k)’ in a signal x(n).

• If ‘k’ is positive, signal will shift rightward i.e. it get delayed or index will shift leftward.
• If ‘k’ is negative, signal will shift leftward i.e. it get advances or index will shift rightward.
Figure 1: Graphical representation of Time Shifting

1.1.1. Advance Signal:


Consider a case where we want our output signal to be advanced by, say, two units. This
objective can be accomplished by shifting the signal to the left by two time units, i.e.
y[n] = x[n+2].
The corresponding input and output signals are shown in Figure 2(a) and 2(b), respectively.
Our output signal has the same values as the original signal but spans from n = -5 to n = 1
instead of n = -3 to n = 3. The signal shown in Figure 2(b) is aptly referred to as a time-
advanced signal.

Figure 2: Original signal and its time-advanced version

1.1.2. Delayed Signal:

Suppose that we want to move the signal given in figure 3a right by three units (i.e., we want
a new signal whose amplitudes are the same but are shifted right three times).

This means that we desire our output signal y[n] to span from n = 0to n = 6. Such a signal is
shown as Figure 3(b) and can be mathematically written as y[n] = x[n-3].
Figure 3: Original signal and its time-delayed version

This kind of signal is referred to as time-delayed because we have made the signal arrive
three units late.

For both of the above examples, note that the time-shifting operation performed over the
signals affects not the amplitudes themselves but rather the amplitudes with respect to the
time axis. We have used discrete-time signals in these examples, but the same applies to
continuous-time signals.

1.1.3. Practical Application of Time Shifting:

Time-shifting is an important operation that is used in many signal-processing applications.


For example, a time-delayed version of the signal is used when performing autocorrelation.
Another field that involves the concept of time delay is artificial intelligence, such as in
systems that use Time Delay Neural Networks.

1.2. Folding/Flipping:
Flipping results in reflection of the original signal along its vertical axis. This process is also
known as Time Reversal.
Here we replace “n” by “-n”.
For example, let's consider our input signal to be x[n], shown in Figure 4(a). The effect of
substituting –n in the place of n results in the signal y[n] as shown in Figure 4(b).
Figure 4: Graphical representation of Folding

1.2.1. Practical Applications of Folding:

Time reversal is an important preliminary step when computing the convolution of signals:
one signal is kept in its original state while the other is mirror-imaged and slid along the
former signal to obtain the result. Time-reversal operations, therefore, are useful in various
image-processing procedures, such as edge detection. A time-reversal technique in the form
of the time reverse numerical simulation (TRNS) method can be effectively used to
determine defects. For example, the TRNS method aids in finding out the exact position of a
notch which is a part of the structure along which a guided wave propagates.

1.3. Time Scaling (Up/down sampling)


Time scaling compresses or dilates a signal by multiplying the time variable by some
quantity. If that quantity is greater than one, the signal becomes narrower and the operation is
called decimation or down sampling. In contrast, if the quantity is less than one, the signal
becomes wider and the operation is called expansion or up sampling, depending on how the
gaps between values are filled. If we multiply any scalar quantity with the independent
variable ‘n’ then we get time scaled representation of the signal (expanded or contracted).
1.3.1 Decimation or Down Sampling:
In decimation, the input of the signal is changed to be f[cn] . The quantity used for
decimation c must be an integer so that the input takes values for which a discrete function is
properly defined. The decimated signal f[cn] corresponds to the original signal f[n] where
only each n sample is preserved (including f[0]), and so we are throwing away samples of the
signal (or decimating it).

Figure 5: Graphical representation of Decimation (Down Sampling)


2.3.2. Expansion or Up Sampling:

In expansion, the input of the signal is changed to be f[nc]. We know that the signal f[n] is
defined only for integer values of the input n. Thus, in the expanded signal we can only place
the entries of the original signal f at values of n that are multiples of c. In other words, we are
spacing the values of the discrete-time signal c−1 entries away from each other. Since the
signal is undefined elsewhere, the standard convention in expansion is to fill in the
undetermined values with zeros.

Figure 6: Graphical representation of Expansion (Up Sampling)

2.3.3. Practical Applications of Time Sampling:

Basically, when we perform time scaling, we change the rate at which the signal is sampled.
Changing the sampling rate of a signal is employed in the field of speech processing. A
particular example of this would be a time-scaling-algorithm-based system developed to read
text to the visually impaired.
Task 1:
Perform time shifting on the following signal
x=[00 0 0 1 11 1 1]
Code:
x=[0 0 0 0 1 1 1 1 1];
n=-4:1:4;
subplot(3,1,1);
stem(n,x,'fill');
title('x(n)');
xlabel('n');
ylabel('Amplitude');
subplot(3,1,2);
stem(n+1,x,'fill');
title('Delayed signal');
xlabel('n');
ylabel('Amplitude');
subplot(3,1,3);
stem(n-1,x,'fill');
title('Advanced signal');
xlabel('n');
ylabel('Amplitude');
Output:

x(n)
1
Amplitude

0.5

0
-4 -3 -2 -1 0 1 2 3 4
n
Delayed signal
1
Amplitude

0.5

0
-3 -2 -1 0 1 2 3 4 5
n
Advanced signal
1
Amplitude

0.5

0
-5 -4 -3 -2 -1 0 1 2 3
n

Figure Task 1
Task 2:
Perform folding on the following signal
x (n)=[0 0 0 01 1 11 1]
Code:
x=[0 0 0 0 1 1 1 1 1];
n=-4:1:4;
subplot(2,1,1);
stem(n,x,'fill');
title('x(n)');
xlabel('n');
ylabel('Amplitude');

y=fliplr(x);
subplot(2,1,2);
stem(n,y,'fill');
title('x(-n)');
xlabel('n');
ylabel('Amplitude');

Output:

x(n)
1
Amplitude

0.5

0
-4 -3 -2 -1 0 1 2 3 4
n
x(-n)
1
Amplitude

0.5

0
-4 -3 -2 -1 0 1 2 3 4
n

Figure Task 2
Task 3:
Perform time scaling on the following signal
x (n)=[0 0 0 01 1 11 1]
Code:
x=[0 0 0 0 1 1 1 1 1];
n=-4:1:4;
subplot(3,1,1);
stem(n,x,'fill');
title('x(n)');
xlabel('n');
ylabel('Amplitude');

y1=downsample(x,2);
n1=-2:1:2;
subplot(3,1,2);
stem(n1,y1,'fill');
title('Downsample(x[2n])');
xlabel('n');
ylabel('Amplitude');

y2=upsample(x,2);
n2=-8:1:9;
subplot(3,1,3);
stem(n2,y2,'fill');
title('Upsamplex([n/2])');
xlabel('n');
ylabel('Amplitude');

Output:

x(n)
1
Amplitude

0.5

0
-4 -3 -2 -1 0 1 2 3 4
n
Downsample(x[2n])
1
Amplitude

0.5

0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
n
Upsamplex([n/2])
1
Amplitude

0.5

0
-8 -6 -4 -2 0 2 4 6 8 10
n

Figure Task 3
Task 4:
If x (n)={−1 0 1 23−2−1 0 1}
Plot the following
1. x (n)
2. x (−3 n)
3. x (−n+5)
4. x (n−6)
5. x (n /4)

CODE:
x=[-1 0 1 2 3 -2 -1 0 1];
n=0:1:8;
subplot(6,1,1);
stem(n,x,'fill');
title('Original x(n)');
xlabel('n');
ylabel('Amplitude');

n1=-8:1:0;
y=fliplr(x);
subplot(6,1,2);
stem(n1,y,'fill');
title('flipped x(-n)');
xlabel('n');
ylabel('Amplitude');
y1=downsample(y,3);
n2=-2.7:1:0;
subplot(6,1,3);
stem(n2,y1,'fill');
title('Downsample(x[3n])');
xlabel('n');
ylabel('Amplitude');
subplot(6,1,4);
stem(n1-5,x,'fill');
title('Advanced signal (x[-n+5])');
xlabel('n');
ylabel('Amplitude');
subplot(6,1,5);
stem(n+6,x,'fill');
title('delayed signal(x[n-6])');
xlabel('n');
ylabel('Amplitude');
y2=upsample(x,4);
n3=-3:1:32;
subplot(6,1,6);
stem(n3,y2,'fill');
title('Upsamplex([n/4])');
xlabel('n');
ylabel('Amplitude');
OUTPUT:

Original x(n)
4
Amplitude

-2
0 1 2 3 4 5 6 7 8
n
flipped x(-n)
4
Amplitude

-2
-8 -7 -6 -5 -4 -3 -2 -1 0
n
Downsample(x[3n])
1
Amplitude

-1

-2
-3 -2.5 -2 -1.5 -1 -0.5
n
Advanced signal (x[-n+5])
4
Amplitude

-2
-13 -12 -11 -10 -9 -8 -7 -6 -5
n
delayed signal(x[n-6])
4
Amplitude

-2
6 7 8 9 10 11 12 13 14
n
Upsamplex([n/4])
4
Amplitude

-2
-5 0 5 10 15 20 25 30 35
n

Figure Task 4

DISCUSSION & CALCULATION:


A discrete or discrete-time signal is a time series that
consists of a series of quantities. Time shifting is done by adding or subtracting shift amounts
to the time variable in the function. Flipping reflects the original signal along the vertical
axis. This process is also called time reversal. Time scaling compresses or expands a signal
by multiplying the time variable by a specified amount. If this amount is greater than 1, the
signal is narrowed and the operation is called decimation or downsampling. In contrast, when
the quantity is less than 1, the signal is widened and the operation is called dilation or
upsampling.

You might also like