L S
AB          HEET    1
LAB 1 OBJECTIVES:
  ⮚ Basic commands in MATLAB for signal generation
  ⮚ Plotting the generated signal.
Project 1.1: Unit Sample and Unit step Sequences:
Introduction:
Two basic discrete-time sequences are the unit sample sequence and the unit step
sequence. A unit sample sequence u[n] of length N can be generated using the
MATLAB command
u = [1              zeros(1,N -1)];
A unit sample sequence ud[n] of length N and delayed by M samples, where
M < N, can be generated using the MATLAB command
ud = [zeros(1,M)                 1           zeros(1,N - M - 1)];
Likewise, a unit step sequence s[n] of length N can be generated using the
MATLAB command
s = [ones(1,N)];
A delayed unit step sequence can be generated in a manner similar to that used in
the generation of a delayed unit sample sequence.
Program P1 1 can be used to generate and plot a unit sample sequence.
% 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]);
Questions:
Q1.1 Run Program P1 1 to generate the unit sample sequence u[n] and display it.
Q1.2 What are the purposes of the commands clf, axis, title, xlabel, and
ylabel?
Q1.3 Modify Program P1_1 to generate a delayed unit sample sequence ud[n]
with a delay of 11 samples. Run the modified program and display the sequence
generated.
Q1.4 Modify Program P1 1 to generate a unit step sequence s[n]. Run the
modified program and display the sequence generated.
Q1.5 Modify Program P1 1 to generate a delayed unit step sequence sd[n] with
an
advance of 7 samples. Run the modified program and display the sequence
generated.
                  END……………………..