You are on page 1of 2

ELC415B

Signal, Spectra and Signal Processing Laboratory

Activity No 3: Sampling, Aliasing and Noise

I. Examples

1.1. Enter the following code in MATLAB command interface.

Ts=1/8000;
t=0:Ts:3;
testone=sin(2*pi*440*t);
sound(testone,8000)
Now enter this
Testtwo=sin(2*pi*8440*t);
sound(testtwo,8000)

Is the 440Hz tone the same as 8440 Hz ? Why?

1.2. White noise can best be characterized as a random signal across the entire frequency
spectrum.
Grab the headset and enter this code in Matlab line by line.

x=randn(1,8000);
plot(x);
sound(x,8000);
x=0.5*x;
sound(x,8000);
x=0.2*x;
sound(x,8000);

II. Problems

2.1. Write a Matlab function that accepts the frequency (F) of a continuous time sinusoid and
a sampling rate (Fs) to generate a discrete time signal equivalent to 2 seconds of the CT
signal. The function then stem plots the first 100 values of the discrete time signal and
generates a tone using the DT signal. Due to limitations with our hardware, the maximum
sampling rate is 8000 samples per second which is the sampling rate of most PC sound cards.

Equations

Continuous Time Signal

( )= 2
=1

Sampling

2.2. Using the function created in 1,generate the plot and tone for the following CT signal
frequencies and corresponding sampling rate.

Signal Frequency (F) Sampling Rate (Fs)


1 300 5000
2 300 1000
3 700 1000
4 1300 1000
5 700 5000

Compare the generated plots and tone of the following signals, write down your observations
and discuss.

a. Signals 1 and 2

b. Signals 2 and 3

c. Signals 2 and 4

d. Signals 2 and 5

2.3. Write a Matlab script that generates a 5-second duration noise signal. Plot the signal and
save it as a wav or mp3 file.

III. Useful Functions

sound
cos
stem
wavwrite, audiowrite
Note: sound(y,Fs) y=signal Fs=sampling rate

You might also like