hw1

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[2πm(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. Let’s 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 % clears all previous variables load train % 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 difficult to see much from this plot. y is a vector that actually represents the discrete-

Upload: eepro808

Post on 11-Jan-2016

212 views

Category:

Documents


0 download

DESCRIPTION

da kine ah

TRANSCRIPT

Page 1: hw1

EE 315 Homework #1due: 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 signalslook like. In this exercise, you primarily type (or copy and paste) MatLab commands (andlearn a few new MatLab commands) and observe. Submit your plots to show that you didthis exercise.

(a) In this part, you work with a signal called chirp. The signal is y(t) = sin[2πm(t)t]. Thisis really a frequency modulated signal (FM) where the message (information) is embeddedin the instantaneous frequency m(t) = t/.1. In the command sound(1000*y,10000), 10,000is 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. Let’s consider a better sound. Below you load train.matwhich is a recording of a train whistle. MAT files are used in MatLab to store matrix data.

clear all % clears all previous variables

load train % 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 difficult to see much from this plot. y is a vector that actually represents the discrete-

Page 2: hw1

time signal y[n]. Use the plot(t,y) command to plot the first 1000 values of the continuous-time signal y(t) (figure(3)). Note that the sampling period is Ts = 1/Fs.

(c) Let’s next work with a sound which is longer. Load handel.mat which is a clip fromHandel’s Messiah. Use the sound command to hear it. Display information about this clipand calculate the exact length of this clip in seconds.

(d) After you load handel. Append the following commands. This will allow you to hearthe effect 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 numberbetween 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. Inthe following script, observe a two-dimensional signal representing a 200× 320 pixel imageof 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 matrixW which consists of a portion of the matrix X).

2