DSP Lab 3
DSP Lab 3
(NUTECH)
DEPARTMENT OF ELECTRICAL
ENGINEERING
EXPERIMENT NO: 3
Operations on Discrete Signals and Periodic Sequences
OBJECTIVE:
The objective of this lab is to understand different operation on signals. How amplitude, time
scaling and signal shifting is done in Matlab, also student will be able to learn how to make
any signal periodic.
1. SIGNAL OPERATIONS:
1.1: SIGNAL SCALING
Description:
In this Operation, each sample is multiplied by a scalar. Use the command “*” for scaling.
Description:
During a shift operation, a signal changes its position in time where each sample of x[n] is
shifted by an amount k to obtain a shifted sequence y [n]={x (n+ k )}.
In Matlab, this operation is not so simple, both “x” and “n” need to be processed separately in
order to get the shifted signal x [n+k ]. Perform following steps to in Matlab to perform the
signal shift.
iii) If k is negative it means shift is towards left i.e. x [n−k ] then do following|
● As signal is shifting towards left time axes “n” should be extended towards left side
by “k” samples i.e. if n is starting at n1 then it should now start at n 1 - k .
NATIONAL UNIVERSITY OF TECHNOLOGY
(NUTECH)
DEPARTMENT OF ELECTRICAL
ENGINEERING
● Since the signal has now moved towards left meaning last “k” samples in “x” are
empty so concatenate “k” zeroes in the end of the sequence x.
Description:
Folding operation is also termed as flipping a signal. The operation of time reversal is
actually an alteration of the signal values between negative and positive times. Assume that x
is the vector that denotes the signal x ¿]. In this operation each sample of x [n] is flipped
around n=0 to obtain a folded sequence
y [n]=x [−n].
Following two steps can be followed to make the lengths of x 1 & x2 and making n1 and n2
same as well.
Compare the starting points of both signals time index vectors i.e. n1(1) and n2(1).
Compare the ending points of both signals time index vectors i.e. n1 (end) and n2 (end).
2. PERIODIC SEQUENCES:
A discrete-time signal x [n] is said to be periodic if there exist a positive constant N (the
period) for which x [n+ N ]=x [n ], for all n. We can easily generate periodic signal in
MATLAB. For example, consider we have a vector x = [1, 1, 0, 0,-1,-1], and we want to
periodically repeat the given vector four times, following is the MATLAB code to do this.
In Lab Assignment:
1. Write Matlab Code for all discrete signal operations described in section 1 and
provide the output.
2. Run the Matlab code described in section 2 and show the output with explanation.
3. Implement a generic unit step sequence with a shift in MATLAB and plot it, provide
the snapshot.
Comments: