Laboratory Exercise 1: Discrete-Time Signals: Time-Domain Representation
Laboratory Exercise 1: Discrete-Time Signals: Time-Domain Representation
%UNIT SAMPLE
clf;
n=-15:15;
x=[zeros(1,15) 1 zeros(1,15)];% create array of zeros
stem(n,x); %plot discrete sequence data
xlabel('time');%label x axis
ylabel('amplitude');%label y axis;
title('unit sample sequence');% title of the plot
axis([-15 15 0 1]);% set min & max limits for X, Y axis
grid on;% make gridlines on graph
Answers:
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
amplitude
0.5
0.4
0.3
0.2
0.1
0
-15 -10 -5 0 5 10 15
time
Q1.2 The purpose of clf command is – to clear figure window
The purpose of axis command is –to give minimum and maximum limits of X and Y axis
The purpose of title command is –to give the title name of plot
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.
0.9
0.8
0.7
0.6
amplitude
0.5
0.4
0.3
0.2
0.1
0
-15 -10 -5 0 5 10 15
time
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.
clf;
n=-15:15;
x=[zeros(1,15) 1 ones(1,15)];% create array of zeros and ones
stem(n,x); %plot discrete sequence data
xlabel('time');%label x axis
ylabel('amplitude');%label y axis;
title('unit step sequnce');% title of the plot
axis([-15 15 0 1]);% set min & max limits for X, Y axis
grid on;% make gridlines on graph
0.9
0.8
0.7
0.6
amplitude
0.5
0.4
0.3
0.2
0.1
0
-15 -10 -5 0 5 10 15
time
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.
clf;
n=-15:15;
x=[zeros(1,8) 1 ones(1,22)];% create array of zeros and ones
stem(n,x); %plot discrete sequence data
xlabel('time');%label x axis
ylabel('amplitude');%label y axis;
title('unit step sequnce delayed by 7 samples');% title of the plot
axis([-15 15 0 1]);% set min & max limits for X, Y axis
grid on;% make gridlines on graph
unit step sequnce delayed by 7 samples
1
0.9
0.8
0.7
0.6
amplitude
0.5
0.4
0.3
0.2
0.1
0
-15 -10 -5 0 5 10 15
time
% Program P1_3
clf;
n = 0:35; a = 1.2; K = 0.2;
x = K*a.^n;
stem(n,x);
xlabel('Time index n');ylabel('Amplitude');
Answers:
Q1.6 The complex-valued exponential sequence generated by running Program P1_2 is shown
below:
Real part
2
1
Amplitude
0
-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
The purpose of the operator imag is –to plot the imag value of X
Q1.10 The purpose of the command subplot is – to plot 2 or more graphs in one graph
Q1.11 The real-valued exponential sequence generated by running Program P1_3 is shown below :
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 -n
Q1.14 The sequence generated by running Program P1_3 with the parameter a changed to 0.9 and
the parameter K changed to 20 is shown below:
20
18
16
14
12
Amplitude
10
0
0 5 10 15 20 25 30 35
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 -
Project 1.3 Sinusoidal sequences
n = 0:40; f = 0.1;
phase = 0; A = 1.5;
arg = 2*pi*f*n - phase; x = A*cos(arg);
clf;
stem(n,x);
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
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 – no
change in graph
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 – no
changes.
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.
The period of this sequence is -12.5
Sinusoidal Sequence
2
1.5
0.5
Amplitude
-0.5
-1
-1.5
-2
0 5 10 15 20 25 30 35 40 45 50
Time index n
Q1.24 By replacing the stem command in Program P1_4 with the plot command, the plot
obtained is as shown below:
Sinusoidal plot
3
1
Amplitude
-1
-2
-3
0 5 10 15 20 25 30 35 40
Time index n
The difference between the new plot and the one generated in Question Q1.17 is –
The new one is in the continuous function of time while other one is in discrete
sequence.
Q1.25 By replacing the stem command in Program P1_4 with the stairs command the
plot obtained is as shown below:
Sinusoidal plot
3
1
Amplitude
-1
-2
-3
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 new one is stairstep graph and other is a discrete sequence graph.
Answers:
Q1.29 The signals generated by running Program P1_5 are displayed below:
Q1.30 The uncorrupted signal s[n]is - s = 2*m.*(0.9.^m)
Answers:
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:
* - matrix multiplication
.* - element wise matrix multiplication
Generation of a swept frequency sinusoidal sequence
Answers:
Q1.36 The swept-frequency sinusoidal sequence x[n] generated by running Program P1_7 is
displayed below.
Q1.37 The minimum and maximum frequencies of this signal are = 0 and 0.025 Hz
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:
Date: Signature: