Project 2
Project 2
Project 2
The system input is a binary sequence bk of bit duration Tb using the following
modulation schemes.
Tb
2 n 0 n1
2
Tb
Additionally, we define:
n0 4
n1 1
The modulated signal is transmitted through the channel and corrupted by noise, assumed
to be white Gaussian with power spectral density S n . The optimum receiver is
2
composed of a matched filter, sampler and threshold detector. The signal which arrives at
the receiver, containing noise, is filtered to produce vo(t), which is then compared to a pre-
determined threshold VT according to the rule:
{| if vo Tb VT
bk {
| if v oT b V T
ˆ 1 0
⎝
Rectangular Pulse
0.8
Amplitude (A)
0.6
0.4
0.2
-0.2
-1.5 -1 -0.5 0 0.5 1 1.5
Time (Tb)
2 A J 1 { j T2 e j 2T ⎞]
b b
|| | e ||
2j ⎝ ⎠|
2 A ⎝ { Tb ]
X ( ) sin
⎞⎝| |
2
⎠
If we consider the sinc pulse as a low-pass signal, that is, one whose main spectral
content is centered about zero, we can take the bandwidth as half the width of the main
spectral lobe. In other words, we need to find roots of X ( ) .
Tb
0 2 A sin {
⎞ |
⎝ 2|
⎠
Tb
sin1 0 2 k 0
2
T
k1 b 0
2 2 k
Tb
k1 2k0
2
2 k
Tb
We now have an adequate relationship to define the bandwidth. For the half width of the
2
main lobe, we use the first root (k=1) and find that the bandwidth is Tb.
3. Noise Power
Gaussian noise power is equivalent to its area as represented in the frequency domain.
Since we have a constant spectral density of 2, we need only take the product of this with
2
our valid range of frequency, which will be limited by the sampling frequency s Ts.
The formulation for the noise power is thus as follows:
|
n {2 ⎞
⎝ 2 T
|
Tss ⎠
4. Signal to Noise Ratio
An effective signal to noise ratio is defined in the following form, since the noise
bandwidth is much larger than the effective bandwidth of signal pulses:
A2Tb
2
When expressed in dB, the amplitude of the modulate pulse (A) is computed as follows:
210 10
A
Tb
0.4
0.3
0.2
0.1
Amplitude
-0.1
-0.2
-0.3
-0.4
-0.5
0 10 20 30 40 50 70 80 90 100
60
Time
0.4
0.3
0.2
0.1
Amplitude
-0.1
-0.2
-0.3
-0.4
-0.5
0 10 20 30 40 50 70 80 90 100
60
Time
Amplitude
-1
-2
-3
0 10 20 30 40 50 70 80 90 100
60
Time
PSK + Noise
3
1
Amplitude
-1
-2
-3
0 10 20 30 40 50 70 80 90 100
60
Time
filter type was implemented in MATLAB. The output produced by the filter was
subsequently used to decode the noisy modulated signal messages. This experiment was
performed for 20 realizations of noise, over a spectrum of signal to noise ratios ranging
from -4dB to +4dB.
PSK
Bit Error Rate
-1
10
-2
10
-4 -3 -2 -1 0 1 2 3 4
SNR
0.09
0.08
0.07
0.06
Reductio
0.05
n
0.04
0.03
0.02
0.01
0
-4 -3 -2 -1 0 1 2 3 4
SNR
Finally, these two graphs demonstrate the proximity of these experimental results to the
theoretical error rates of PSK and FSK modulation schemes. The curves follow the same
trends and are within small margins of each other. Thus, the experiment results are found
to agree very closely with our theoretical expectations.
Theoretical and Experimental FSK Perormance
0
10
Theoretical
Experimental
Performance
-1
10
-2
10
-4 -3 -2 -1 0 1 2 3 4
SNR
Performance
-1
10
-2
10
-4 -3 -2 -1 0 1 2 3 4
SNR
MATLAB Code
%**************************************************************************
%** Computer Simulation On Matched Filters for BPSK and BFSK Detection **
%** Diego Benavides 0241824 **
%** March 29, 2007 **
%**************************************************************************
%**************************************************************************
%** Initialize workspace **************************************************
close all;
clear;
clc;
%*****
******
******
******
******
******
******
******
******
n0=4; % used for w1, bfsk
******
****** % used for w2, bfsk
******
n1=1;
***
N=20; % defined in project outline
% sampling period of binary sequence
%*****
Ts=1; % period of binary sequence
******
Tb=N*
******
Ts;
******
eta=2; % noise spectral content
******
******
******
SNRe=-4:4; % SNR: -4dB to 4dB
******
******
******
t=0:N-1; % timing for simulation
******
bitLength=500; % chosen abritrarily
******
***
%** Constants and Variable Setup ******************************************
vi=1;
toPlot=0; % virtual
set to 1index
to show some sample graphs
bko_psk=zeros(1,bitLength);
%**************************
***************************
*********************
%**************************************************************************
%** Set up shift keying frequencies ***************************************
w1=2*pi*(n0+n1)/Tb; % first bfsk frequency
% second bfsk frequency
w2=2*pi*(n0-n1)/Tb;
wc=n0*2*pi/Tb; % carrier frequency, bpsk
%**************************************************************************
for SNR_loop=1:length(SNRe)
for TRIAL_loop=1:N % 20 independent trials
err_fsk=0;
err_psk=0;
%**********************************************************************
%** Use A to setup signal functions ***********************************
s1_fsk=A(SNR_loop)*cos(w1*t); % bfsk 1
% bfsk 0
s2_fsk=A(SNR_loop)*cos(w2*t);
s1_psk=A(SNR_loop)*cos(wc*t); % bpsk 1
s2_psk=-A(SNR_loop)*cos(wc*t); % bpsk 0
v_psk=s_psk+noise;
if(toPlot==1) % display preliminary output if desired
figure(1)
plot(s_fsk);
axis([0,100,-1/2,1/2]);
title('Random Binary
FSK Signal');
ylabel('Amplitude');
xlabel('Time');
set(gcf,'Color',[1 1 1])
grid on
figure(2)
plot(s_psk);
axis([0,100,
-1/2,1/2]);
title('Rando
m Binary PSK
Signal');
ylabel('Amplitude');
xlabel('Time');
set(gcf,'Color',[1 1 1])
grid on
figure(3)
plot(v_fsk);
axis([0,100,-3,3]);
title('Random
Binary FSK
Signal');
ylabel('Amplitude');
xlabel('Time');
set(gcf,'Color',[1 1 1])
grid on
figure(4)
plot(v_psk);
axis([0,100,-3,3]);
title('Random
Binary PSK
Signal');
ylabel('Amplitude');
xlabel('Time');
mf_fsk=fliplr(s1_fsk-s2_fsk); % BFSK output
set(gcf,'Color',[1 1 1])
mf_psk=fliplr(s1_psk- % BPSK output
grid on
s2_psk);
end
vo_fsk=conv(v_fsk,mf_fsk);
vo_psk=vo_psk(1:bitLength*N);
% sample the output signal
for m=N:N:(bitLength*N)
vo_fsk(m/N)=vo_fsk(m);
vo_psk(m/N)=vo_psk(m);
end
%7. threshold detection
for m=1:bitLength*N;
if(vo_fsk(m)<=0) % PSK detection
bko_fsk(m)=0;
else
bko_fsk(m)=1;
end
if(bk(m)~=bko_psk(m))
err_psk=err_psk+1;
end
end
ber_fsk(TRIAL_loop)=err_fsk/bitLength;
ber_psk(TRIAL_loop)=err_psk/bitLength;
end
performance_fsk(SNR_loop)=mean(ber_fsk);
performance_psk(SNR_loop)=mean(ber_psk);
end
%**********************************************************************
%** Overal results ****************************************************
figure(5)
semilogy(SNRe,performance_fsk,'-ok');
hold on
semilogy(SNRe,performance_psk,'-or');
title('Performance of FSK vs PSK');
ylabel('Bit Error Rate');
xlabel('SNR');
legend('FSK','PSK');
set(gcf,'Color',[1 1 1])
grid on
figure(6)
plot(SNRe,performance_fsk-performance_psk)
title('Error Rate Reduction, PSK vs
FSK'); ylabel('Reduction')
xlabel('SNR')
axis([-4,4,0,0.1]);
set(gcf,'Color',[1 1 1])
grid on
figure(7)
semilogy(SNRe,1/2*erfc(1/2*sqrt(Tb/eta*A.^2)),'r');
hold on
semilogy(SNRe,performance_psk);
title('Theoretical and Experimental PSK Perormance');
ylabel('Performance')
xlabel('SNR')
legend('Theoretical','Experimental');
set(gcf,'Color',[1 1 1])
grid on
figure(8)
semilogy(SNRe,1/2*erfc(1/2*sqrt(Tb/eta/2*A.^2)),'r');
hold on
semilogy(SNRe,performance_fsk);
title('Theoretical and Experimental FSK Perormance');
ylabel('Performance')
xlabel('SNR')
legend('Theoretical','Experimental');
set(gcf,'Color',[1 1 1])
grid on
%************************************
**********************************