Sie sind auf Seite 1von 3

Mehran University of Engineering and Technology, Jamshoro

Institute of Information Technology


Digital Signal Processing
Lab
Multirate Digital Signal Processing
PERFORMANCE OBJECTIVE
Upon successful completion of this experiment, the student will be able to:
To Alter the sampling rate of the signal.
EQUIPMENT
COMPUTER.
MATLAB SOFTWARE (version 5.3 or later).
DSP TOOL BOX
DISCUSSION
The MATLAB Signal Processing toolbox may be used to carry out a variety of operations
associated with sampling rate conversion and multirate processing. The key functions are
listed below:
decimate
interp
upfirdn
resample
Use on line MATLAB help to find out more about these functions.
Following examples illustrate the use of these functions:
Example 1: A discrete time signal is given by
y = sin(0.1n)
decimate the signal by a factor of 2 and 4.
Plot the original and decimated signals. Use the decimate function.
Solution:

x=0:1:100;
y = sin(0.1*pi*x);
y1= decimate(y,2);
% decimation of y by a factor 2
y2= decimate(y,4);
% decimation of y by a factor 4
subplot(311)
stem(y(1:length(y)))
ylabel('original signal')

grid
subplot(312)

stem(y1(1:length(y1)))
ylabel('decimated by 2')
grid
subplot(313)
stem(y2(1:length(y2)))
xlabel('Time')
ylabel('decimated by 4')
grid
Example2: Repeat the above example with resample function.
x=0:1:100;
y = sin(0.1*pi*x);
y1= resample(y,1,2);
% sampling rate reduction by a factor of
2
y2= resample(y,1,4);
% sampling rate reduction by a factor of
4.
subplot(311)
stem(y(1:length(y)))
ylabel('original signal')
grid
subplot(312)
stem(y1(1:length(y1)))
ylabel('decimated by 2')
grid
subplot(313)
stem(y2(1:length(y2)))
xlabel('Time')
ylabel('decimated by 4')
grid

Example 3: Consider the signal of example 1. Interpolate the signal by a factor of 2 and
4 using interp function.
Solution.
x=0:1:100;
y = sin(0.1*pi*x);
y1= interp(y,2);
y2= interp(y,4);
subplot(311)
stem(y(1:length(y)))
ylabel('original signal')
grid
subplot(312)
stem(y1(1:length(y1)))
ylabel('interpolated by 2')
grid
subplot(313)
stem(y2(1:length(y2)))
xlabel('Time')
ylabel('interpolated by 4')
grid

Exercise 1: Repeat example 3 using resample function.


Exercise 2: Repeat example 3 to decimate the signal by a factor of 2/3.
Exercise 3: Repeat example 4 to interpolate the signal by a factor of 5/2.
Exercise 4: A continuous time signal is characterized by the following function:
x(t) = Acos(2f1t) + Bcos(2f2t)
(a) Generate, with the aid of MATLAB, a discrete time equivalent of the signal.
Assume a sampling frequency of 1 kHz, f1 = 50 Hz, f2 = 100 Hz, A = 1.5 & B = 1.
(b) Interpolate the discrete time signal by a factor of 4 using the interp command.
(c) Decimate the output of the interpolator in step (b) by a factor of 4 using the
decimate function.
(d) Plot the original, interpolated and decimated discrete time signals.
FINAL CHECK LIST
Submit your answers to question, before the next laboratory

Das könnte Ihnen auch gefallen