Sie sind auf Seite 1von 6

Lab# 07 Sampling and Multi-rate Signal Processing

Objective:
The purpose of this lab is to acquaint students with the following concepts practically:
 Sampling
 Rates of sampling
 Up sampling/ Interpolation
 Down sampling/ Decimation
 Filtering within Sampling – More commonly known as the process of anti-aliasing.

Task 1:
Use your ‘sin’ function to generate a sine wave with f = 3kHz and sample it with fs = 8kHz.
Calculate its fft with zero frequency component in the middle. Plot it on a properly scaled w-
axis. Specify if there is aliasing or not?

Output figure Aliasing or not


Little impulses in the DFT represent the energy leakage due to the finite length of the signal.

Task 2:
Use your ‘sin’ function to generate a sine wave with f = 3kHz and sample it with fs = 5kHz.
Calculate its fft with zero frequency component in the middle. Plot it on a properly scaled w-axis.
Specify if there is aliasing or not?

Output figure Aliasing or not

Changing Sampling rate in a Discrete Signal


1. y = decimate(x,R) – To down-sample a signal. Here ‘x’ is the array containing the signal to
be down-sampled and ‘R’ is the down-sampling factor/ratio
2. y = interp(x,R) – To up-sample a signal. Here ‘x’ is the array containing the signal to be up-
sampled and ‘R’ is the up-sampling factor/ratio

Task 3: Aliasing In a Speech Signal


Up till now you have studied and performed theoretical concepts, whether these theoretical tools
you have studied in the DSP theory and simulated in DSP lab have any practical significance?
How a signal is processed, in this section we are going to perform an example of aliasing on a
speech signal. We are going to perform following steps for this purpose.
1. Record your voice in MATLAB or use a recorded audio file and play the audio using
play, sound or audioplayer
2. Take its fft and plot it

3. Decimate the speech signal first by 2 and later by 3 and then perform step ii. Now
compare the fft of original and decimated signals and deduce your opinion about the
effect of aliasing by listening the reconstructed signal and their fft plots.

4. Now take the interpolated signal by 3 and perform step ii, afterwards decimate it by 2.
Play the signal listen to it check whether its quality has deteriorated or not due to aliasing.
Decimate the signal further by 2 until aliasing has appeared and voice quality of the
signal has deteriorated. Also observe how fft plot is affected due decimation and
interpolation.

Required code:

Step-1: Process of Recording audio signal

Or to load from a file:


Step-2: Taking FFT and plotting

Step-3: Decimation

now follow the step-2 to take and plot its fft.

Step-4: Interpolation

Now follow the step-2 to take fft and and plot it.

Plot the fft of the original sound signal


Plot the fft of the down-sampled version

Plot the fft of the up-sampled version

Task 4:
Use your ‘sin’ or ‘cos’ function to generate a sinusoid wave having two components as f1 =
3kHz and f2 = 5kHz and then sample it with fs = 10kHz. Calculate its fft with zero frequency
component in the middle. Plot it on a properly scaled w-axis. Specify if there is aliasing or not?
If there is aliasing specify which component is casing the aliasing.
Code and output

Task 5:
Use your ‘sin’ or ‘cos’ function to generate a sinusoid wave having two components as f1 =
3kHz and f2 = 5kHz and then sample it with fs = 8kHz. Calculate its fft with zero frequency
component in the middle. Plot it on a properly scaled w-axis. Specify if there is aliasing or not?
If there is aliasing specify which component is casing the aliasing.

Code and output


Task 6:
Take a speech signal, plot its fft, now decimate by 2,3,4 … until the spectrum goes outside the
range {-fs/2, fs/2} (That’s when aliasing appears). Now do the reverse process i.e. interpolate by
… 4,3,2 and see whether the original signal has recovered or not listening the reconstructed
signal. Note that you are required to plot fft at all stages.
Code and output

Das könnte Ihnen auch gefallen