Sie sind auf Seite 1von 4

Amplitude Modulation radio --- a MATLAB

experiment for Purdue ECE 301, by Prof. Chih-


Chun Wang.

Preparation

1. Download the different wav files x1.wav (Save it as “x1.wav”.)

2. Download the ece301conv.m file.

3. Open MATLAB and change the directory to where you have saved the previous files.

4. Enter the following commands

duration=8;

f_sample=44100;

t=(((0-4)*f_sample+0.5):((duration-4)*f_sample-0.5))/f_sample;

5. Load x1(t) by the commands

[x1, f_sample, N]=wavread('x1');

x1=x1';

(Now you can look at what x1(t) looks like by “plot(t, x1);”

Or you can listen to x1 by “wavplay(x1,f_sample);”)

Basic operations:

1. If you want to construct a sin wave with frequency 440Hz, use the following commands:

f=440;

s=sin(2*pi*f*t);

If you want to construct a sinc function sinc(t), use the command:

sc=sin(pi*t)./(pi*t);

Note: every time you do vector multiplication or division, you need to add a period “.” before the “*” and “/”
operator.

2. The convolution of two signals x1 and x2 can be achieved by the following command

y=ece301conv(x1,x2);

Requirement: You are asked to plot several figures. Print all the figures for each objective. Your HW score
will be graded based on your figures.

Objective 1: Use the following commands separately to see what a sin and a sinc function look like. (Please
print out the graphs as those printouts will help the TA to grade this experiment.)

plot(t, s);

axis([-0.01,0.01,-2,2]);

grid on;

plot(t,sc);

axis([-4,4,-0.5,1.5]);

grid on;

You should note that the sinc function crosses the x-axis at the integer points.

Objective 2: Synthesize the US dial tone. The US dial tone consists of two frequencies: 440Hz and 350 Hz.
Let us use MATLAB to synthesize the US dial tone.

s1=sin(2*pi*440*t);

s2=sin(2*pi*350*t);

y=s1+s2;

wavplay(y,f_sample);

plot(t,y);

axis([-2.28, -2.255, -2.2 2.2]);


Note: You have to pay special attention to the unit of the frequency. Simply using “s1=sin(440*t)” does not
work.

Objective 3: Construct an ideal low-pass filter which filters out all frequencies larger than 1kHz. Note 1:
First write down the mathematical expression of the low pass filter h(t) and then construct it in MATLAB. In
the end, use the following commands to see what h(t) is going to look like. (Please print it out.) Note 2: You
have to pay special attention to the unit of the frequency.

plot(t,h);

axis([-0.01,0.01,-3000,3000]);

grid on;

Objective 4: Use the convolution function as described in Basic Operations to pass x1(t) through an ideal
LPF described in Objective 2. Let the output be x1_lpf(t). Use the following commands to see what x1_lpf(t)
is going to look (or sound) like, and describe what has happened after passing x1(t) through the LPF and
explain why it is like that. Print out the graph. (Note: Look at the details of the original x1(t) and see how
x1_lpf(t) has been smoothed out.)

wavplay(x1_lpf,f_sample);

plot(t, x1,t,x1_lpf);

legend('x1', 'x1_lpf');

axis([-2.28, -2.255, -0.08 0.08]);

Zoom in the figure by the following command

axis([-2.2715, -2.2685, 0.025, 0.052]);

What has happened to the new signal x1_lpf? Does it follow your intuition?

[Optional] Create a different low pass filter and use it to separate the two sinusoidal signals in the dial tone
signal. Plot and zoom-in the resulting signal. Do you see the original sinusoidal of frequency 350 Hz? There
is no need to turn in the result of this optional task.

Objective 5: Construct the AM modulated signal y(t) from x1_lpf(t) by letting y(t)=x1_lpf(t).*cos(w_c t)
where the carrier frequency is 4kHz. Print out the graph by the following commands. Zoom in by yourself to
see what’s going on at the very detailed level.
wavplay(y,f_sample); // Be careful! The new y signal is not audible.

plot(t, x1_lpf, t,y);

legend('x1_lpf', 'y');

axis([-2.28, -2.255, -0.08 0.08]);

Zoom in the figure by the following command

axis([-2.2715, -2.2685, 0.025, 0.052]);

Objective 6: [Demodulation] Multiply y(t) by cos(w_c t) where the carrier frequency is 4kHz. And then pass
it through the low pass filter constructed previously. Then multiply it by 2 to obtain the demodulated signal.
Use w(t) to denote the end result. Execute the following commands and print out the graph. Do you have the
exact match between the input/out signals?

wavplay(w,f_sample);

plot(t,x1_lpf, t, w);

legend('x1_lpf', 'w');

axis([-2.28, -2.255, -0.08 0.08]);

Zoom in the figure by the following command

axis([-2.2715, -2.2685, 0.025, 0.052]);

Das könnte Ihnen auch gefallen