Laboratory Exercise 1: Discrete-Time Signals: Time-Domain Representation
Laboratory Exercise 1: Discrete-Time Signals: Time-Domain Representation
Laboratory Exercise 1
DISCRETE-TIME SIGNALS: TIME-DOMAIN REPRESENTATION
Q1.1 The unit sample sequence u[n] generated by running Program P1_1 is shown below:
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
-10 -5 0 5 10 15 20
The purpose of axis command is –it control axis appearance and scaling
The purpose of title command is –it adds text at the top of the current axis.
The purpose of xlabel command is –it adds text beside the X-axis on the current axis. The
purpose of ylabel command is – it adds text beside the Y-axis on the current axis.
1
Vrunda shah (IE)
Q1.3 The modified Program P1_1 to generate a delayed unit sample sequence ud[n] with a delay of 11 samples is
given below along with the sequence generated by running this program .
Answers:
% Program P1_1
% Generation of a Unit Sample Sequence
clf;% Generate a vector from -10 to 20
n = -10:20;
% Generate the unit sample sequence
u = [zeros(1,10) 1 zeros(1,20)];
% Plot the unit sample sequence
stem(n+11,u);
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 5 10 15 20 25 30 35
Q1.4 The modified Program P1_1 to generate a unit step sequence s[n] is given below along with the sequence
generated by running this program .
Answers:
% Program P1_1
% Generation of a Unit Sample Sequence
clf;% Generate a vector from -10 to 20
n = -10:20;
% Generate the unit sample sequence
u = [zeros(1,10) 1 ones(1,20)];
% Plot the unit sample sequence
stem(n,u);
2
Vrunda shah (IE)
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
-10 -5 0 5 10 15 20
Q1.5 The modified Program P1_1 to generate a unit step sequence sd[n] with an advance of 7 samples is given
below along with the sequence generated by running this program .
Answers:
% Program P1_1
% Generation of a Unit Sample Sequence
clf;% Generate a vector from -10 to 20
n = -10:20;
% Generate the unit sample sequence
u = [zeros(1,10) 1 ones(1,20)];
% Plot the unit sample sequence
stem(n-7,u);
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
-20 -15 -10 -5 0 5 10 15
3
Vrunda shah (IE)
Answers:
% Program P1_2
% Generation of a complex exponential sequence
clf;
c = -(1/12)+(pi/6)*i;
K = 2;
n = 0:40;
x = K*exp(c*n);
subplot(2,1,1);
stem(n,real(x));
xlabel('Time index n');ylabel('Amplitude');
title('Real part');
subplot(2,1,2);
stem(n,imag(x));
xlabel('Time index n');ylabel('Amplitude');
title('Imaginary part');
% Program P1_3
% Generation of a real exponential sequence
clf;
n = 0:35; a = 1.2; K = 0.2;
x = K*a.^n;
stem(n,x);
xlabel('Time index n');ylabel('Amplitude');
Q1.6 The complex-valued exponential sequence generated by running Program P1_2 is shown below :
Real part
2
1
Amplitude
-1
-2
0 5 10 15 20 25 30 35 40
Time index n
Imaginary part
2
Amplitude
-1
0 5 10 15 20 25 30 35 40
Time index n
Q1.7 The parameter controlling the rate of growth or decay of this sequence is –c
4
Vrunda shah (IE)
Real part
50
Amplitude
-50
0 5 10 15 20 25 30 35 40
Time index n
Imaginary part
100
Amplitude
50
-50
0 5 10 15 20 25 30 35 40
Time index n
Q1.9 The purpose of the operator real is – it is used to represent real value
Q1.11 The real-valued exponential sequence generated by running Program P1_3 is shown below :
5
Vrunda shah (IE)
120
100
80
Amplitude
60
40
20
0
0 5 10 15 20 25 30 35
Time index n
Q1.12 The parameter controlling the rate of growth or decay of this sequence is –a
Q1.13 ^ and .^ is –
The difference between the arithmetic operators “^”
raises a square matrix to a power using matrix multiplication.
“.^” raises the elements of a matrix or vector to a power; this is a “pointwise” operation.
Q1.14 The sequence generated by running Program P1_3 with the parameter a changed to 0.9 and the parameter K
18
16
14
12
Amplitude
10
0
0 5 10 15 20 25 30 35
Time index n
6
Vrunda shah (IE)
It can be changed to generate sequences with different lengths as follows (give an example command line and
the corresponding length) :
For n= 0:19;
20
18
16
14
12
Amplitude
10
0
0 2 4 6 8 10 12 14 16 18 20
Time index n
Q1.16 The energies of the real-valued exponential sequences x[n]generated in Q1.11 and Q1.14 and computed using
the command sum are –
clf;
n=0:35; a=1.2; k=0.2;
x=k*a.^n;
b=0.9; c=20;
y=c*b.^n;
energy=sum(x.^2+y.^2)
energy =4.7777e+04
7
Vrunda shah (IE)
% Program P1_4
% Generation of a sinusoidal sequence
n = 0:40; f = 0.1;
phase = 0; A = 1.5;
arg = 2*pi*f*n - phase; x = A*cos(arg);
clf; % Clear old graph
stem(n,x); % Plot the generated sequence
axis([0 40 -2 2]); grid;
title('Sinusoidal Sequence'); xlabel('Time index n');
ylabel('Amplitude'); axis;
Q1.17 The sinusoidal sequence generated by running Program P1_4 is displayed below .
Sinusoidal Sequence
2
1.5
0.5
Amplitude
-0.5
-1
-1.5
-2
0 5 10 15 20 25 30 35 40
Time index n
A sequence with new frequency can be generated by the following command line :
f=0.5;
The parameter controlling the phase of this sequence is -phase
8
Vrunda shah (IE)
A sequence with new length __21___ can be generated by the following command line :0:20;
sum(x(1:10).*x(1:10))/10 = 1.1250
The purpose of grid command is - to turn on the drawing of grid lines on the graph.
Q1.22 The modified Program P1_4 to generate a sinusoidal sequence of frequency 0.9 is given below along with the
sequence generated by running it .
% Program Q1_22A
% Generation of a sinusoidal sequence
n = 0:40;
f = 0.9;
phase = 0;
A = 1.5;
arg = 2*pi*f*n - phase;
x = A*cos(arg);
clf; % Clear old graph
stem(n,x); % Plot the generated sequence
axis([0 40 -2 2]);
grid;
title('Sinusoidal Sequence');
xlabel('Time index n');
ylabel('Amplitude');
axis;
Sinusoidal Sequence
2
1.5
0.5
Amplitude
-0.5
-1
-1.5
-2
0 5 10 15 20 25 30 35 40
Time index n
A comparison of this new sequence with the one generated in Question Q1.17 shows –
9
Vrunda shah (IE)
in Q1.17 that f = 0.1 Hz/sample. For the modified program in Q1.22, we have f = 0.9
Hz/sample, which generates the 0.1. Again because cosine is even, this makes a graph
thatsame graph as f = 0.9 – 1 = is identical to the one we got in Q1.17 with f = +0.1
Hz/sample.
A sinusoidal sequence of frequency 1.1 generated by modifying Program P1_4 is shown below.
Sinusoidal Sequence
2
1.5
0.5
Amplitude
-0.5
-1
-1.5
-2
0 5 10 15 20 25 30 35 40
Time index n
A comparison of this new sequence with the one generated in Question Q1.17 shows -
A comparison of this new sequence with the one generated in Question Q1.17 shows - the
graph here is again identical to the one in Q1.17. This is because a cosine of frequency f =
1.1 Hz/sample is identical to one with frequency f = 1.1 – 1 = 0.1 Hz/sample, which was
the frequency used in Q1.17.
Q1.23 The sinusoidal sequence of length 50, frequency 0.08, amplitude 2.5, and phase shift of 90 degrees generated by
modifying Program P1_4 is displayed below .
10
Vrunda shah (IE)
Sinusoidal Sequence
3
Amplitude
0
-1
-2
-3
0 5 10 15 20 25 30 35 40
Time index n
The period of this sequence is - = 1/f = 1/0.08 = 1/(8/100) = 100/8 = 25/2./ The period of this
sequence is - 2
Q1.24 By replacing the stem command in Program P1_4 with the plot command, the plot obtained is as shown
below:
Sinusoidal Sequence
2
1.5
0.5
Amplitude
-0.5
-1
-1.5
-2
0 5 10 15 20 25 30 35 40
Time index n
Q1.25 By replacing the stem command in Program P1_4 with the stairs command the plot obtained is as shown
below:
11
Vrunda shah (IE)
Sinusoidal Sequence
2
1.5
0.5
Amplitude
-0.5
-1
-1.5
-2
0 5 10 15 20 25 30 35 40
Time index n
The difference between the new plot and those generated in Questions Q1.17 and Q1.24 is –
the “stairs” command produces a stairstep plot as opposed to the stem graph that was generated
in Q1.17 and the straight-line interpolation plot that was generated in Q1.24.
Answers:
12
Vrunda shah (IE)
Q1.29 The signals generated by running Program P1_5 are displayed below :
10
d[n]
Amplitude
5 s[n]
x[n]
-5
0 5 10 15 20 25 30 35 40 45 50
Time index n
8
y[n]
6
Amplitude
s[n]
0
0 5 10 15 20 25 30 35 40 45 50
Time index n
Q1.30 The uncorrupted signal s[n]is - a linear growth with a slowly decaying real exponential.
The additive noise d[n]is– a random sequence uniformly distributed between -0.4 and +0.4.
Q1.31 x = s + d CAN / CANNOT be used to generate the noise corrupted signal because - d is a
The statement
column vector, whereas s is a row vector; it is necessary to transpose one of these vectors
before adding them.
Q1.32 x1, x2, and x3, and the signal x are - all three signals x1, x2, and
The relations between the signals
x3 are extended versions of x, with one additional sample appended at the left and one
additional sample appended to the right. The signal x1 is a delayed version of x, shifted
one sample to the right with zero padding on the left. The signal x2 is equal to x, with
equal zero padding on both the left and right to account for the extended length. Finally,
x3 is a time advanced version of x, shifted one sample to the left with zero padding on the
right.
Q1.33 The purpose of the legend command is - to create a legend for the graphs.
13
Vrunda shah (IE)
xH = sin(2*pi*fH*n);
xL = sin(2*pi*fL*n);
y = (1+m*xL).*xH;
figure;
stem(n,y);
grid;
xlabel('Time index n');
ylabel('Amplitude');
Q1.34 The amplitude modulated signals y[n] generated by running Program P1_6 for various values of the
frequencies of the carrier signal xH[n] and the modulating signal xL[n], and various values of the modulation
index m are shown below:
1.5
0.5
Amplitude
-0.5
-1
-1.5
-2
0 50 100 150 200 250 300
Time index n
Answers:
14
Vrunda shah (IE)
ylabel('Amplitude');
grid;
axis;
Q1.36 The swept-frequency sinusoidal sequence x[n] generated by running Program P1_7 is displayed below .
0.5
Amplitude
-0.5
-1
-1.5
0 50 100 150 200 250 300
Time index n
Q1.37 The minimum and maximum frequencies of this signal are - 0, 0.5 hz/samples
Q1.38 The Program P1_7 modified to generate a swept sinusoidal signal with a minimum frequency of 0.1 and a
maximum frequency of 0.3 is given below :
15
Vrunda shah (IE)
0.28
0.26
0.24
0.22
Amplitude
0.2
0.18
0.16
0.14
0.12
0.1
0 50 100 150 200 250 300
Time index n
Date: Signature:
16