Professional Documents
Culture Documents
(b) The sound of chirp is boring. Lets consider a better sound. Below you load train.mat
which is a recording of a train whistle. MAT files are used in MatLab to store matrix data.
clear all
load train
time signal y[n]. Use the plot(t,y) command to plot the first 1000 values of the continuoustime signal y(t) (figure(3)). Note that the sampling period is T s = 1/F s.
(c) Lets next work with a sound which is longer. Load handel.mat which is a clip from
Handels Messiah. Use the sound command to hear it. Display information about this clip
and calculate the exact length of this clip in seconds.
(d) After you load handel. Append the following commands. This will allow you to hear
the eect of random noise.
noise=.25*(rand(size(y))-.5);
y_with_noise=y+noise;
sound(y_with_noise,Fs)
The rand command generates a vector (or matrix) where each element is a random number
between 0 and 1. We could use some of the ideas from EE 213 to filter out the noise.
(e) Another type of signal is an image. Instead of the independent variable being time (t),
it can be space n1 , n2 where n1 and n2 are the row and column numbers of a matrix. In
the following script, observe a two-dimensional signal representing a 200 320 pixel image
of a clown.
clear all
load clown
whos
colormap(gray)
imagesc(X)
Use help colormap and help imagesc to learn about these commands.
As an exercise, plot a smaller portion of the image which includes the nose (find a matrix
W which consists of a portion of the matrix X).