0% found this document useful (1 vote)
130 views3 pages

Lab 9 Open Ended Lab

The document discusses upsampling and interpolation, which involve increasing the sampling rate of a signal. Upsampling inserts zeros between samples, while interpolation also filters the signal. Decimation and downsampling reduce the sampling rate by discarding samples, with decimation applying lowpass filtering first to avoid aliasing. Matlab code demonstrates these concepts on a sinusoidal signal. Questions ask the reader to analyze these effects on a speech signal and observe upsampling in the frequency domain.

Uploaded by

nouman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
130 views3 pages

Lab 9 Open Ended Lab

The document discusses upsampling and interpolation, which involve increasing the sampling rate of a signal. Upsampling inserts zeros between samples, while interpolation also filters the signal. Decimation and downsampling reduce the sampling rate by discarding samples, with decimation applying lowpass filtering first to avoid aliasing. Matlab code demonstrates these concepts on a sinusoidal signal. Questions ask the reader to analyze these effects on a speech signal and observe upsampling in the frequency domain.

Uploaded by

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

Digital Signal Processing Lab FURC Department of Electrical Engineering

Lab 9: Open Ended Lab

Upsampling and Interpolation:


“Upsampling” is the process of inserting zero-valued samples between original samples to
increase the sampling rate. (This is called “zero-stuffing”.) Upsampling adds to the original
signal undesired spectral images which are centered on multiples of the original sampling rate.

“Interpolation”, in the DSP sense, is the process of upsampling followed by filtering. (The
filtering removes the undesired spectral images.) As a linear process, the DSP sense of
interpolation is somewhat different from the “math” sense of interpolation, but the result is
conceptually similar: to create “in-between” samples from the original samples. The result is as
if you had just originally sampled your signal at the higher rate.

The primary reason to interpolate is simply to increase the sampling rate at the output of one
system so that another system operating at a higher sampling rate can input the signal.

The interpolation factor is simply the ratio of the output rate to the input rate. It is usually
symbolized by “L”, so output rate / input rate=L.

Decimation and Downsampling:


“decimation” is the process of reducing the sampling rate. In practice, this usually implies
lowpass-filtering a signal, then throwing away some of its samples.

“Downsampling” is a more specific term which refers to just the process of throwing away
samples, without the lowpass filtering operation. Throughout this FAQ, though, we’ll just use the
term “decimation” loosely, sometimes to mean “downsampling”.

The decimation factor is simply the ratio of the input rate to the output rate. It is usually
symbolized by “M”, so input rate / output rate=M.

The most immediate reason to decimate is simply to reduce the sampling rate at the output of one
system so a system operating at a lower sampling rate can input the signal. But a much more
common motivation for decimation is to reduce the cost of processing:
the calculation and/or memory required to implement a DSP system generally is proportional to
the sampling rate, so the use of a lower sampling rate usually results in a cheaper
implementation.A signal can be downsampled (without doing any filtering) whenever it is
“oversampled”, that is, when a sampling rate was used that was greater than the Nyquist criteria
required. Specifically, the signal’s highest frequency must be less than half the post-
decimation sampling rate. (This just boils down to applying the Nyquist criteria to the input
signal, relative to the new sampling rate.)

1
Digital Signal Processing Lab FURC Department of Electrical Engineering

In most cases, though, you’ll end up lowpass-filtering your signal prior to downsampling, in
order to enforce the Nyquist criteria at the post-decimation rate. For example, suppose you have
a signal sampled at a rate of 30 kHz, whose highest frequency component is 10 kHz (which is
less than the Nyquist frequency of 15 kHz). If you wish to reduce the sampling rate by a factor of
three to 10 kHz, you must ensure that you have no components greater than 5 kHz, which is the
Nyquist frequency for the reduced rate. However, since the original signal has components up to
10 kHz, you must lowpass-filter the signal prior to downsampling to remove all components
above 5 kHz so that no aliasing will occur when downsampling.

This combined operation of filtering and downsampling is called decimation.You get aliasing–


just as with other cases of violating the Nyquist criteria. (Aliasing is a type of distortion which
cannot be corrected once it occurs.)

Matlab Code for Interpolation and Decimation:

clc; % clears the command window


close all; % closes all the previously open window
clear all; % clears previously stored values
fm = 10; % input signal frequency
Fs = 140; % sampling frequency
t = 0:1/Fs:0.5; % time range for the input sequence
x = sin(2*pi*fm*t); % input sinusoidal signal
figure(1)
subplot(4,1,1)
stem(x); % Discrete plot of the input sequence,...
... where x-axis corresponds to the number of
samples
xlabel('No. of samples'); % labelling x-axis
ylabel('Amplitude'); % labelling y-axis
title('input discrete sinusoidal sequence'); % giving title to the plot
M = 2; % factor by which the input sequence is decimated
xd = decimate(x,M); % resamples the sample in x with a rate (1/M) times the
original rate
subplot(4,1,2)
stem(xd) % Discrete plot of the input sequence,...
... where x-axis corresponds to the number of samples
xlabel('No. of samples'); % labelling x-axis
ylabel('Amplitude'); % labelling y-axis
title('Decimated Sinusoidal Sequence'); % giving title to the plot
L = 2; % factor by which the input sequence is interpolated
xI = interp(x,L); % resamples the sample in x with a rate L times the
original rate
subplot(4,1,3);
stem(xI); % Discrete plot of the input sequence,...
... where x-axis corresponds to the number of samples
xlabel('No. of samples'); % laeblling x-axis
ylabel('Amplitude'); % labelling y-axis
title('Interpolated Sinuoidal Sequence') % giving title to the plot
L = 2; % coefficient by which the singal is interpolated
xI = interp(xd,L); % resamples the sample in x with a rate L times the
original rate
subplot(4,1,4)

2
Digital Signal Processing Lab FURC Department of Electrical Engineering

stem(xI); % Discrete plot of the input sequence,...


... where x-axis corresponds to the number of samples
xlabel('No. of samples'); % labelling x-axis
ylabel('Amplitude'); % labelling y-axis
title('Original Signal Obtained After Interpolating the Decimated Signal'); %
giving title to the graph

Q1

To observe the effect of up sampling in frequency domain we first need to generate a


band limited input sequence. This can be achieved in MATLAB by use of the function
"fir2". This function is generally used for filter design using the window method and
will help us generate an arbitrary filter shape. Usage of the function is as fir2(N,F,M),
where N is the order of the FIR digital filter with the frequency response specified by
vectors F and M. Vectors F and M specify the frequency and magnitude break points
for the filter and the frequencies in F must be between 0.0 < F < 1.0, with 1.0
corresponding to half the sample rate. For this exercise use freq = [0 0.45 0.5 1]
and mag = [ 0 1 0 0 ] as the F and M vectors and 99 for N and evaluate and plot
the input spectrum. Then generate the up-sampled sequence and evaluate and plot
its spectrum.

Q2

Analyse the effect of decimation, interpolation, high-pass filter and lowpass on a speech signal
using m=2, l=2.

You might also like