You are on page 1of 2

EE 315 Homework #1

due: Mon, Sept 9


Reading: Lathi (L): Chapter 1 (omit 1.9, 1.10).
Previous Reading: Study the parts of Chapter B (Background) which you are not clear.
1. 1.2.2
2. 1.3.2
3. 1.3.3
4. 1.5.2 a,b
5. 1.7.10
6. 1.7.13
7. The purpose of this exercise is to see what actual audio (sounds, speech) and image signals
look like. In this exercise, you primarily type (or copy and paste) MatLab commands (and
learn a few new MatLab commands) and observe. Submit your plots to show that you did
this exercise.
(a) In this part, you work with a signal called chirp. The signal is y(t) = sin[2m(t)t]. This
is really a frequency modulated signal (FM) where the message (information) is embedded
in the instantaneous frequency m(t) = t/.1. In the command sound(1000*y,10000), 10,000
is the sampling rate. This means that y(t) is sampled at the rate of 10,000 samples/sec.
t = 0:.01:3;
y = sin(2*pi*t.^2/.1);
sound(1000*y, 10000)
figure(1)
plot(t(1:100),y(1:100))

% observe that the frequency increases with time

(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

% clears all previous variables


% this loads the train whistle recording which was stored on the
% system as a 12,880 row vector. this vector is loaded into your
% session as vector y with a default sampling rate of Fs=8196.
whos
% observe the characteristics of your vectors
figure(2)
plot(y)
It is dicult to see much from this plot. y is a vector that actually represents the discrete-

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).

You might also like