0% found this document useful (0 votes)
9 views23 pages

Bai Lam 1

The document outlines a laboratory exercise focused on discrete-time signals and their time-domain representation, including the generation of various sequences using MATLAB programs. It covers unit sample sequences, exponential signals, sinusoidal sequences, and random signals, along with modifications to generate delayed and advanced sequences. Additionally, it discusses signal smoothing, complex signals, and the generation of square-wave and sawtooth signals.

Uploaded by

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

Bai Lam 1

The document outlines a laboratory exercise focused on discrete-time signals and their time-domain representation, including the generation of various sequences using MATLAB programs. It covers unit sample sequences, exponential signals, sinusoidal sequences, and random signals, along with modifications to generate delayed and advanced sequences. Additionally, it discusses signal smoothing, complex signals, and the generation of square-wave and sawtooth signals.

Uploaded by

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

Name:Nguyễn Ngọc Minh Tâm

Section:

Laboratory Exercise 1
DISCRETE-TIME SIGNALS: TIME-DOMAIN REPRESENTATION

1.1 GENERATION OF SEQUENCES

Project 1.1 Unit sample and unit step sequences

A copy of Program P1_1 is given below.

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,u);
xlabel('Time index n');ylabel('Amplitude');
title('Unit Sample Sequence');
axis([-10 20 0 1.2])

1
Q1.1 The unit sample sequence u[n] generated by running Program P1_1 is shown
below:

Q1.2 The purpose of clf command is - clear current figure window.

The purpose of axis command is -set axis limits and appearance.

The purpose of title command is -add title to axes or legend.

The purpose of xlabel command is -label x-axis.

The purpose of ylabel command is -label y-axis.

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.

2
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 .

3
Q1.5 The modified Program P1_1 to generate a unit step sequence sd[n] with an ad-
vance of 7 samples is given below along with the sequence generated by running
this program.

Project 1.2 Exponential signals

A copy of Programs P1_2 and P1_3 are given below.

4
Answers:

Q1.6 The complex-valued exponential sequence generated by running Program P1_2 is


shown below:

5
< Insert MATLAB figure(s) here. Copy from figure window(s) and
paste. >

Q1.7 The parameter controlling the rate of growth or decay of this sequence is - he real
part of parameter “C”.

The parameter controlling the amplitude of this sequence is - parameter “K”.

Q1.8 The result of changing the parameter c to (1/12)+(pi/6)*i is – the exponential


is increasing, tín hiệu phân kỳ

Q1.9 The purpose of the operator real is -used to get the real part of a vector.

The purpose of the operator imag is -used get the imaginary of a vector.

Q1.10 The purpose of the command subplot is -used to create axes in tiled positions.

Q1.11 The real-valued exponential sequence generated by running Program P1_3 is


shown below:

6
Q1.12 The parameter controlling the rate of growth or decay of this sequence is -
parameter “a”.

The parameter controlling the amplitude of this sequence is - parameter “K”.


Q1.13 The difference between the arithmetic operators ^ and .^ is -dùng ^ nếu mà mũ

không có phụ thuộc vào bất kỳ tham số nào

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:

7
Q1.15 The length of this sequence is - 36

It is controlled by the following MATLAB command line :n=0:35

It can be changed to generate sequences with different lengths as follows (give an


example command line and the corresponding length):n=0:99

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 -
2.1042e+03 for Q1.14 and 4.5673e+04 for Q1.11

sum(x.*x);

Project 1.3 Sinusoidal sequences

A copy of Program P1_4 is given below.

8
Answers:

Q1.17 The sinusoidal sequence generated by running Program P1_4 is displayed below .

9
Q1.18 The frequency of this sequence is – f=0.1Hz

It is controlled by the following MATLAB command line : f = 0.1;

A sequence with new frequency _1hz__ can be generated by the following


command line:f=1;

The parameter controlling the phase of this sequence is -phase

The parameter controlling the amplitude of this sequence is -A

The period of this sequence is – T=1/f=1/0.1=10

Q1.19 The length of this sequence is – 41 samples

It is controlled by the following MATLAB command line :n=0:40

A sequence with new length _61__ can be generated by the following command
line:n=0:60;

Q1.20 The average power of the generated sinusoidal sequence is – N=10

Q1.21 The purpose of axis command is - set axis limits and appearance.

The purpose of grid command is -display or hide axes grid lines.

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 .

10
A comparison of this new sequence with the one generated in Question Q1.17
shows - The two signals are the same

A sinusoidal sequence of frequency 1.1 generated by modifying Program P1_4 is


shown below.

11
A comparison of this new sequence with the one generated in Question
Q1.17 shows - The two signals are the same

Because cos(x)=cos(-x) so cos(1.1*2pi)-2pi=0.1*2pi

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 .

12
The
period of this sequence is – T=1/0.08

Q1.24 By replacing the stem command in Program P1_4 with the plot command, the
plot obtained is as shown below:

13
The difference between the new plot and the one generated in Question Q1.17 is -
plot displays the continuous values and stem displays the discrete values

Q1.25 By replacing the stem command in Program P1_4 with the stairs command the
plot obtained is as shown below:

The difference between the new plot and those generated in Questions Q1.17 and Q1.24 is
- stairs command draws a stairstep graph.

Project 1.4 Random signals

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 :

14
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:

15
Q1.28 The MATLAB program to generate and display five sample sequences of a random
sinusoidal signal of length 31

{X[n]} = {Acos(on + )}

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 .

16
17
18
1.2 SIMPLE OPERATIONS ON SEQUENCES

Project 1.5 Signal Smoothing

A copy of Program P1_5 is given below.

Answers:

% Program P1_5
% Signal Smoothing by Averaging
clf;
R = 51;
d = 0.8*(rand(R,1) - 0.5); % Generate random noise
m = 0:R-1;
s = 2*m.*(0.9.^m); % Generate uncorrupted signal
x = s + d'; % Generate noise corrupted signal
subplot(2,1,1);
plot(m,d','r-',m,s,'g--',m,x,'b-.');
xlabel('Time index n');ylabel('Amplitude');
legend('d[n] ','s[n] ','x[n] ');
x1 = [0 0 x];x2 = [0 x 0];x3 = [x 0 0];
y = (x1 + x2 + x3)/3;
subplot(2,1,2);
plot(m,y(2:R+1),'r-',m,s,'g--');
legend( 'y[n] ','s[n] ');
xlabel('Time index n');ylabel('Amplitude');

Q1.29 The signals generated by running Program P1_5 are displayed below :

Answers:

19
Q1.30 The uncorrupted signal s[n]is decreasing exponential function

The additive noise d[n]is random signal with an amplitude between -4 and 4

Q1.31 The statement x = s + d CAN / CANNOT be used to generate the noise


corrupted signal because rand(R,1) are R rows and 1 column so we with to transpose
to have 1 row and R columns to add s and d.

Q1.32 The relations between the signals x1, x2, and x3, and the signal x:x1 x2 x3 is
another version of x. x1 is the advanced signal of x, located on the left, while x2 is the
delayed signal of x, on the right.

Q1.33 The purpose of the legend command is add legend to axes

Project 1.6 Generation of Complex Signals

A copy of Program P1_6 is given below.

< Insert program code here. Copy from m-file(s) and paste. >

Answers:
% Program P1_6
% Generation of amplitude modulated sequence
clf;
n = 0:100;
m = 0.4;fH = 0.1; fL = 0.01;
xH = sin(2*pi*fH*n);
xL = sin(2*pi*fL*n);
y = (1+m*xL).*xH;
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:

20
Q1.35 The difference between the arithmetic operators * and .* is "*" performs matrix

multiplication on two conformable matrices, while ".*" performs element-wise

multiplication on elements in the same row and column.

A copy of Program P1_7 is given below.

< Insert program code here. Copy from m-file(s) and paste. >

Answers:
% Program P1_7
% Generation of a swept frequency sinusoidal sequence
n = 0:100;
a = pi/2/100;
b = 0;
arg = a*n.*n + b*n;
x = cos(arg);
clf;
stem(n, x);
axis([0,100,-1.5,1.5]);
title('Swept-Frequency Sinusoidal Signal');
xlabel('Time index n');
ylabel('Amplitude');
grid; axis;

Q1.36 The swept-frequency sinusoidal sequence x[n] generated by running Program


P1_7 is displayed below.

21
Q1.37 The minimum and maximum frequencies of this signal are -

Q1.38 The Program 1_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 :
% Program P1_7
% Generation of a swept frequency sinusoidal sequence
n = 0:100;
a = pi/500;
b = 0.2*pi;
arg = a*n.*n + b*n;
x = cos(arg);
clf;
stem(n, x);
axis([0,100,-1.5,1.5]);
title('Swept-Frequency Sinusoidal Signal');
xlabel('Time index n');
ylabel('Amplitude');
grid; axis;

22
1.3 WORKSPACE INFORMATION

Q1.39 The information displayed in the command window as a result of the who
command is -

Q1.40 The information displayed in the command window as a result of the whos
command is -

1.4 OTHER TYPES OF SIGNALS (Optional)

Project 1.8 Squarewave and Sawtooth Signals

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:

23

You might also like