Professional Documents
Culture Documents
I. Examples
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)
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
( )= 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.
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.
sound
cos
stem
wavwrite, audiowrite
Note: sound(y,Fs) y=signal Fs=sampling rate