Transmitter Blocks

advertisement
EE 490/599: Communications Systems Topics
Homework 2, Spring 2010: Transmitter Blocks
Homework #2 is due on Tuesday, February 2, 2010, at the beginning of class. You may either email your project writeup to me at sheryl.howard@nau.edu, or turn in a hard copy. Late
homework is accepted for one week past the due date at a penalty of 20% off.
This homework asks you to simulate a transmitter using an 8-PAM (pulse amplitude modulation)
symbol mapping, rectangular pulse-shaping and DSB-SC (double-sideband suppressed carrier) modulation. DSB-SC is a common form of amplitude modulation (AM) carrier modulation. Simulation
involves programming 4 blocks:
1. Generate a random binary vector v of length N.
2. Map each 3-bit group to an 8-PAM symbol m of length L = N/3.
3. Pulse-shape the symbols with a rectangular pulse p(t) to obtain the pulse-shaped symbol
PL−1
sequence x(t) = k=0
m[k]p(t − kT ).
4. Upconvert the pulse-shaped symbol sequence x(t) by multiplying it by a cosine wave c(t) =
cos(ωt) to obtain the DSB-SC transmitted signal s(t) = x(t)c(t).
Each block is described in more detail below.
1
Problem 1: Binary Vector Generation
The Matlab function rand(1,N) will generate a 1 x N vector of uniformly random values, taken
from the unit interval (0,1). To obtain binary values vi ∈ {0, 1}, you will need to convert the values
that rand gives you into binary. The round command is very useful for this. Or you may use
a conditional statement. The find statement can also be used to convert the uniformly random
values to binary, although this requires some thought to do correctly.
1. Write a function in either Matlab or C/C++ that generates a random binary vector v of
length N, with equiprobable values vi = 0 or 1 (p(vi = 1) = p(vi = 0) = 0.5), ∀i = 1, . . . , N.
The vector length N should also be an input parameter. The output of this function will be
your random binary vector v of length N.
2. Run your function for a vector length of N = 12000. Calculate p(vi = 1) and p(vi = 0). Show
that your experimental p(vi = 1) ∼ p(vi = 0) ∼ 0.5.
3. Generate a random binary vector v of length 48. Save this vector as you will use it at the end
of the next problem. You do not need to print out v for this HW.
1
EE 490/599, Comms Topics: HW 2, Spring 2010
2
2
Problem 2: 8-PAM Symbol Mapping
The goal of this section is to generate an 8-PAM symbol sequence from your binary sequence. The
8-PAM symbol mapping is shown below.
Binary Group
8-PAM Symbol
000 001 010 011 100 101 110 111
-7
-5
-3
-1
1
3
5
7
1. Write a program that will convert each 3-bit group of your binary sequence v to an 8-PAM
symbol using the mapping above. Your program should output the 8-PAM symbol sequence
m, which will have length L = N/3. Remember to account for the fact that N must be
divisible by 3 to obtain integer L. You may do one of two things: 1) Your program may fail
with an output message stating something to the effect that ’Length N must be divisible by
3’; or 2) Your program may add an extra 1 or 2 bits (which must be defined; please make
them zero) as needed to create a whole 8-PAM symbol.
2. Include your program.
3. Test your program by running a test case. Your input binary vector
v = 100 010 101 000 111 001 011 110. What is your output 8-PAM sequence m? Show
the result from your program.
4. Now convert your previously-generated binary vector v of length 48 to an 8-PAM sequence
m. Include the output values of m in your HW writeup. You do not have to print out v.
3
Problem 3: Pulse-Shaping
1. Generate a rectangular pulse p(t) of width Ts = 10 ms. Make p(t) a vector such that p(t) = 1
for t = 0 up to but not including 10 ms, with a time step of 100 µs. In other words, p(t)
is a vector of ones of length J = 100. Our pulse is this large so that we can multiply the
pulse-shaped sequence x(t) directly with the carrier c(t).
P
2. You want to generate a pulse-shaped symbol sequence x(t) = L+1
k=0 m[k]p(t − kTs ), using your
p(t) above. Note that p(t) is ’continuous’, while m[k] is discrete. Also note that we want to
multiply one symbol m[k] by the rectangular pulse p(t − kTs ) during the time interval t = kTs
up to (but not including) t = (k + 1)Ts . The easiest way to do this is to create an analog (or
upsampled) version of m[k], which we’ll call m(t). The upsampled m(t) = m[k] when t = kTs
and m(t) = 0 otherwise.
First generate an all-zeros vector mt of length JL (remember, the length of p(t) is J).
3. Now make every Jk + 1 element of mt = m[k]; that is, mt[1] = m[1], mt[101] = m[2], etc.
The ’+1’ is added because Matlab indices start at 1, not 0.
EE 490/599, Comms Topics: HW 2, Spring 2010
3
P
L−1
4. Now generate the rectangular pulse-shaped symbol sequence x(t) = k=0
m[k]p(t − kTs ),
using the analog (upsampled) m(t) above. Do this by using the filter command in Matlab:
x=filter(p,1,mt);
will generate a rectangular pulse-shaped sequence where the first J = 100 values will be m[1],
the second J values will be m[2], and so on.
5. Plot the first 10 symbol periods of x(t); in other words, plot the first 10J values of x. Every
J values should correspond to one symbol m.
6. Another way to generate x(t) is with the conv command in Matlab. However, the conv
command gives an extra 99 zeros at the end of x(t) (in this example) for a vector of length
100L + (100 − 1). These extra zeros are not conveying any useful information and should be
truncated.
4
Problem 4: Upconversion: DSB-SC Modulation
1. Generate a time vector tc that starts at t = 0 and ends at t = 5 ms, with time step ∆t = 100µs.
2. Generate a carrier wave c(t) = cos(2π1000t). Plot c(t) (on the vertical axis) versus your time
vector tc (on the horizontal axis). Make sure that both vectors are the same size. Label each
axis of your plot and title your plot. Include your plot in your HW assignment file.
3. Generate a time vector t that starts at t = 0, ends at t = 159.9 ms, with time step ∆t = 100µs.
4. Generate a longer vector of your carrier wave c(t), with the time vector t above.
5. Multiply your pulse-shaped sequence x(t) by your carrier wave c(t) above to create your
upconverted signal s(t) = x(t)c(t). The signal s(t) is the signal you would transmit to the
receiver.
6. Plot the first 3 symbol time periods of s(t); that is, plot s(t = 0) to s(t = 3Ts ). Label your
axes and title your plot.
7. Now plot the last 3 symbol time periods of s(t). Label your axes and title your plot.
8. Could you see any phase changes between symbol periods in either of the two plots above?
9. Can you extract the symbol information m directly from the envelope of s(t)? Why or why
not?
Related documents
Download