S S.Lab.5
S S.Lab.5
OBJECTIVE:
LEARNING OUTCOMES:
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).
• 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
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.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
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.
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.
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