LABEX11
LABEX11
Section:
Laboratory Exercise 1
DISCRETE-TIME SIGNALS: TIME-DOMAIN REPRESENTATION
% Program P1_1
clf;
n = -10:20;
u = [zeros(1,10) 1 zeros(1,20)];
stem(n,u);
axis([-10 20 0 1.2]);
Q1.1 The unit sample sequence u[n] generated by running Program P1_1 is shown below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
1
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 .
< Insert program code here. Copy from m-file(s) and paste. >
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 .
< Insert program code here. Copy from m-file(s) and paste. >
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
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 .
< Insert program code here. Copy from m-file(s) and paste. >
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
% Program P1_2
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));
title('Real part');
subplot(2,1,2);
stem(n,imag(x));
title('Imaginary part');
% Program P1_3
clf;
x = K*a.^n;
stem(n,x);
Answers:
Q1.6 The complex-valued exponential sequence generated by running Program P1_2 is shown below :
3
Q1.7 The parameter controlling the rate of growth or decay of this sequence is -n
4
Q1.9 The purpose of the operator real is – phần thực
Q1.10 The purpose of the command subplot is – tạo trục ở các vị trí xếp kề nhau
Q1.11 The real-valued exponential sequence generated by running Program P1_3 is shown below :
5
Q1.12 The parameter controlling the rate of growth or decay of this sequence is –n
Q1.13 The difference between the arithmetic operators ^ and .^ is – (^ dùng khi nhân ma trận với ma
trận với nhau) còn (.^ dùng khi từng phần tử trong ma trận nhân với chính 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:
6
Q1.15 The length of this sequence is – 36 mẫu
It is controlled by the following MATLAB command line : stem(n,x);
It can be changed to generate sequences with different lengths as follows (give an example
command line and the corresponding length) : n = -5:30;
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 -
% Program P1_4
n = 0:40;
f = 0.1;
phase = 0;
A = 1.5;
7
arg = 2*pi*f*n - phase;
x = A*cos(arg);
axis([0 40 -2 2]);
grid;
title('Sinusoidal Sequence');
ylabel('Amplitude');
axis;
Answers:
Q1.17 The sinusoidal sequence generated by running Program P1_4 is displayed below .
8
It is controlled by the following MATLAB command line : f = 0.1;
A sequence with new frequency suitable can be generated by the following command line :
The parameter controlling the phase of this sequence is - phase
The parameter controlling the amplitude of this sequence is - A
A sequence with new length suitable can be generated by the following command line :
Q1.21 The purpose of axis command is – kiểm soát tỷ lệ trục và sự xuất hiện
The purpose of grid command is – đường lưới
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 P1_4
n = 0:40;
f = 0.1;
phase = 0;
A = 1.5;
x = A*cos(arg);
axis([0 40 -2 2]);
grid;
title('Sinusoidal Sequence');
ylabel('Amplitude');
axis;
9
A comparison of this new sequence with the one generated in Question Q1.17 shows - trình tự như
nhau nhưng khác tần số
A sinusoidal sequence of frequency 1.1 generated by modifying Program P1_4 is shown below.
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
A comparison of this new sequence with the one generated in Question Q1.17 shows -
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
The period of this sequence is - 15
Q1.24 By replacing the stem command in Program P1_4 with the plot command, the plot obtained is as
shown below:
11
The difference between the new plot and the one generated in Question Q1.17 is –hình này là
đường sóng hình sin còn Q.17 là xung dirac hình thành dạng sóng sin
Q1.25 By replacing the stem command in Program P1_4 with the stairs command the plot obtained is as
shown below:
12
The difference between the new plot and those generated in Questions Q1.17 and Q1.24 is – new plot
có hình dạng là bậc thang kiểu sóng sin, nó phức tạp hơn Q1.17 và Q1.24
Answers:
Q1.26 The MATLAB program to generate and display a random signal of length 100 with elements uniformly
distributed in the interval [–2, 2] is given below along with the plot of the random sequence generated
by running the program :
% Program P1_4
% Generation of a sinusoidal sequence
n = 0:100;
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 100 -2 2]);
grid;
title('Sinusoidal Sequence');
13
xlabel('Time index n');
ylabel('Amplitude');
axis;
Q1.27 The MATLAB program to generate and display a Gaussian random signal of length 75 with elements
normally distributed with zero mean and a variance of 3 is given below along with the plot of the
random sequence generated by running the program :
< Insert program code here. Copy from m-file(s) and paste. >
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
Q1.28 The MATLAB program to generate and display five sample sequences of a random si nusoidal signal of
length 31
where the amplitude A and the phase are statistically independent random variables with uniform
probability distribution in the range 0 A 4 for the amplitude and in the range 0
for the phase is given below. Also shown are five sample sequences generated by running this program
five different times.
< Insert program code here. Copy from m-file(s) and paste. >
14
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
% Program P1_5
clf;
R = 51;
m = 0:R-1;
subplot(2,1,1);
plot(m,d','r-',m,s,'g--',m,x,'b-.');
y = (x1 + x2 + x3)/3;
subplot(2,1,2);
plot(m,y(2:R+1),'r-',m,s,'g--');
Answers:
Q1.29 The signals generated by running Program P1_5 are displayed below :
15
Q1.30 The uncorrupted signal s[n]is -
Q1.31 The statement x = s + d CAN / CANNOT be used to generate the noise corrupted signal because -
Q1.32 The relations between the signals x1, x2, and x3, and the signal x are -
% Program P1_6
clf;
n = 0:100;
16
xH = sin(2*pi*fH*n);
xL = sin(2*pi*fL*n);
y = (1+m*xL).*xH;
stem(n,y);grid;
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:
Q1.35 The difference between the arithmetic operators * and .* is - (* dùng khi nhân ma trận với ma
trận với nhau) còn (.* dùng khi từng phần tử trong ma trận nhân với chính nó)
% Program P1_7
17
% Generation of a swept frequency sinusoidal sequence
n = 0:100;
a = pi/2/100;
b = 0;
x = cos(arg);
clf;
stem(n, x);
axis([0,100,-1.5,1.5]);
ylabel('Amplitude');
grid; axis;
Answers:
Q1.36 The swept-frequency sinusoidal sequence x[n] generated by running Program P1_7 is displayed
below.
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
< Insert program code here. Copy from m-file(s) and paste. >
Q1.39 The information displayed in the command window as a result of the who command is – hiển thị
thông tin về người dùng hiện đang đăng nhập vào hệ thống.
Q1.40 The information displayed in the command window as a result of the whos command is - – hiển thị
thông tin về người dùng hiện đang đăng nhập vào hệ thống.
18
Answer:
Q1.41 MATLAB programs to generate the square-wave and the sawtooth wave sequences of the type shown
in Figures 1.1 and 1.2 are given below along with the sequences generated by running these programs :
< Insert program codes here. Copy from m-file(s) and paste. >
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
Date: Signature:
19