Final Project Part II MATLAB Session: ES 156 Signals and Systems 2007 Seas
Final Project Part II MATLAB Session: ES 156 Signals and Systems 2007 Seas
MATLAB Session
ES 156 Signals and Systems
2007
SEAS
PreparedbyFrankTompkins
Outline
freqz() command
Step by step through the communication
system
Explanation of new concepts and new
MATLAB functions
High-level view of flow through the system
Next week we talk in more detail about
implementation
Eye diagrams
Start Early!
Project is complex
Not something you can do in one day
Less hand-holding than MATLAB
exercises in homework
More like real-life projects
freqz()
Same inputs as filter()
Plots frequency response
channelFilterTaps = [1 0 -1/2 3/8 zeros(1,28)];
freqz(channelFilterTaps, 1);
Overall Idea
Want to transmit a digital image from point A to
point B using radio waves, etc.
We wont actually build antennas/wires
Simulate the whole thing in MATLAB
Image Pre-Processing
Break image into 8 pixel by 8 pixel blocks and
take DCT of each block
Quantize DCT coefficients into 256 levels by
representing them as 8-bit unsigned numbers
blkproc()
MATLAB command for applying a function
in blocks to a matrix
Example: apply DCT in 8 by 8 blocks
I = imread(myimage.tif');
fun = @dct2;
J = blkproc(I, [8 8], fun);
Quantization
Approximate a continuous range of values by a
set of discrete values
Quantization
In MATLAB uint8()
x = 5.7;
xq = uint8(x);
Conversion
reshape()
Takes elements columnwise
>> x = [1 2 3; 4 5 6; 7 8 9]'
x=
1
>> reshape(x,1,9)
ans =
1
permute()
>> x = rand(1,2,2)
x(:,:,1) =
0.4565
0.0185
x(:,:,2) =
0.8214
0.4447
de2bi()
>> x = [4; 212; 19]
x=
4
212
19
>> de2bi(x)
ans =
0
Modulation
Modulate each bit by a sine wave and put into the channel
Implementation details are up to you
What is written in the PDF file is a suggestion
We will however take off points if you use more than one for
loop in your code
That one should loop over the N-sized block groups to send
each one through the channel in turn
0.5
-0.5
-1
10
15
t
20
25
30
10
15
t
20
25
30
1
0.5
0
-0.5
-1
Modulated [1 0 0 1]
1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
20
40
60
80
100
120
140
Channel
Atmosphere, telephone wire, coaxial cable
We model it as an LTI system
Impulse response h(t)
Noise
We will use zero mean AWGN
Additive White Gaussian Noise
AWGN
>> randn(2,3)
ans =
-0.4326
0.1253 -1.1465
-1.6656
0.2877
1.1909
-1
-2
-3
20
40
60
80
100
120
140
Receiver Equalization
Attempt to undo distortion of modulated signal
(sine wave) due to channel and noise
We will try two equalizing filters
Zero Forcing (ZF)
Minimum Mean Square Error (MMSE)
MMSE Filter
Takes noise into account
Derived by minimizing the average error
Well just take it on faith
Detection
Examine equalized signal to determine
whether a 1 or a 0 was sent over channel
Optimal detector is a thresholder
Threshold Detector
Integrate (sum) the transmitted and
equalized half-sine pulse
If integral (sum) < 0, decide a 0 was sent
Else decide a 1 was sent
Conversion to an Image
After receiving all block groups, use
reshape()and permute() to rebuild the
block DCT image
Conversion to an Image
Image Post-Processing
Use blkproc() to compute inverse block
DCT
Thats it!
ZF/MMSE Equalizers
Since MMSE handles noise, it should perform better
than ZF
Eye Diagrams
Coming up next
Different Channels
Optional
Eye Diagrams
Used to visualize how waveforms used to
send (modulate) multiple bits of data can
lead to detection errors
The more open the eye, the lower the
probability of error
Consider modulated half-sine pulses for
four subsequent transmitted bits
Modulated [1 0 0 1]
1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
20
40
60
80
100
120
140
-1
-2
-3
20
40
60
80
100
120
140
[1 0 0 1] Eye Diagrams
Before Channel
After Channel