0% found this document useful (0 votes)
48 views

Exercise#03 1

This document discusses an exercise to familiarize students with generating and plotting signals in MATLAB. It introduces discrete-time signals, which are stored as row vectors with a corresponding time index vector. It demonstrates how to generate and plot elementary discrete-time signals like unit sample sequences and unit step sequences. The conclusion restates that the student has learned the basic MATLAB commands for signal generation and plotting discrete-time signals.

Uploaded by

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

Exercise#03 1

This document discusses an exercise to familiarize students with generating and plotting signals in MATLAB. It introduces discrete-time signals, which are stored as row vectors with a corresponding time index vector. It demonstrates how to generate and plot elementary discrete-time signals like unit sample sequences and unit step sequences. The conclusion restates that the student has learned the basic MATLAB commands for signal generation and plotting discrete-time signals.

Uploaded by

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

Signals, Spectra and Signal Processing (ECE 307)

Names of Students: Christopher Dumaplin , John Lambert Sabran

Date:
Section:
Exercises #03
Generation of Sequence

Introduction:
The purpose of this exercise is to familiarize you with the basic commands in MATLAB for signal
generation and for plotting the generated signal. MATLAB has been designed to operate on data stored
as vectors or matrices. For our purposes, sequences will be stored as vectors.

Part 1 – Discrete-time Signals


A discrete-time signal is a row vector whose elements are the samples taken from a continuous-time
signal. It is of the general form

with the arrow indicates the sample at time index n = 0 which will serve as our reference. However in
MATLAB, we cannot have information about the sample position directly from this row vector. Therefore,
to completely define discrete-time signals in MATLAB, we need to define two row vectors, one for x(n)
and another one for n. For example, to define the sequence

you issue the command


>> n =[-3:4]; x = [2 1 -1 0 1 4 3 7];
and use the stem function to plot the discrete-time signal, as shown below
>> stem(n,x);grid on;title('Discrete-time signal x(n)')

1
How should the following signals be defined? Plot them on the spaces provided below

a. b.

c. d.

2
Part 2 – Elementary discrete time signals
The unit sample sequence is defined as

and its delayed version is

A unit sample sequence defined for is shown below

If this sequence is delayed by two samples, the plot becomes

3
Q2.1 Show how these plots are generated.

Tip: A shortcut to define a matrix whose elements are zeroes or ones only, you can use the command
zeros(m,n) and ones(m,n) where m-by-n is the size of the matrix containing zeros or ones as
elements, respectively. For example to define a row vector of zeroes, use
>> zeros(1,10)
and it will generate a row vector of ten zeros. The command
>> ones(1,12)
will generate a row vector of twelve ones. Try issuing the command
>> [zeros(1,3) 1 zeros(1,3)]
and observe the results.

4
Q2.2 Define the following unit sample sequences and plot the results in MATLAB

a. A unit sample sequence of length 10 from


n=[0:9]; x = [1 zeros(1,9)];
stem(n,x); grid on; title('a')

b. The same unit sample sequence in (a) delayed by five samples


n=[0:9]; x = [zeros(1,5) 1 zeros(1,4)];
stem(n,x); grid on; title('b')

5
c. The same unit sample sequence in (a) delayed by three samples
n=[0:9]; x = [zeros(1,3) 1 zeros(1,6)];
stem(n,x); grid on; title('c')

d. The same unit sample sequence in (a) advanced by five samples


n=[-5:9]; x = [1 zeros(1,14)];
stem(n,x); grid on; title('d')

6
e. The same unit sample sequence in (a) advanced by three samples.
n=[-3:9]; x=[1 zeros(1,12)];
stem(n,x); grid on; title('e')

The unit step sequence is defined as

and its delayed version

Q2.3 Generate a length-7 unit step sequence and its delayed version of two samples. Plot the
sequence on the spaces provided below

n=[-3:3]; x=[zeros(1,3) ones(1,4)];


stem(n,x); grid on; title('Unit Step Sequence')

n=[-3:3]; x=[zeros(1,3) ones(1,4)];

7
=[-3:3]; x=[zeros(1,3) ones(1,4)];
stem(n,x); grid on; title('Unit Step Sequence')

n=[-3:3]; x=[zeros(1,5) ones(1,2)];


stem(n,x); grid on; title('Unit Step Sequence Delay')

Observation:

8
Conclusion:
In this laboratory experiment, I have been familiarized with the different basic commands in MATLAB that
are used for the generation of signal and plotting of a signal. In this activity, discrete-time signals are
being plotted. Discrete-time signal is a form of a continuous-time signal wherein it is function of an
independent variable that is an integer. Elementary discrete time signals are also plotted such as the unit
sample sequence, unit step sequence, real-valued exponential sequence, complex-valued exponential
sequence, sinusoidal sequence, and random sequence.

You might also like