Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Project 2

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 15

Computer Simulation on Matched Filters for Detection of

BSPK and BFSK Signals


1. Background
Using the binary transmission system shown below this project examines matched filter
simulations for BPSK and BFSK schemes.

Figure 1: Binary Transmission System

The system input is a binary sequence bk of bit duration Tb using the following
modulation schemes.

BFSK Modulated Signal BPSK Modulated Signal

{| s1 t   A cos 1t  if bk {| s1 t    A cos c t  if bk


s t  { s t   {
|⎝s2 t   A cos 2t  if bk  |⎝s2 t    A cos c t  if bk 
 1 1
0 0

Where we have the following frequencies: The carrier frequency is as follows:


2 n 0 n 
1 c 4 2Tb
1

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 oT b  V T
ˆ 1 0

2. Rectangular Pulse Bandwidth (Null-To-Null)

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)

Figure 2: Rectangular Pulse

The frequency spectrum required for representation of a perfect rectangular pulse of


width Tb is infinite. This is due to the fact that a rectangular pulse has a Fourier
representation of a sinc pulse in the frequency domain, which is defined along the entire
spectrum. The following calculation demonstrates this in practice.
J { T ⎞ { T ⎞]
x(t)  A ⎝|u ⎝| t  b ⎠|  u | t b
2 ⎠2]
X ( )  F x(t) ⎝
||

 j t
J { Tb ⎞ { Tb dt
 u t e
∫ A⎝]|u | t 2 ⎠| ⎝| 2 |⎠|]
 
⎞ 
 J ⎝
|  ]
 A | ∫e jt dt ∫e jt dt|
|⎝T2b T b ||
2 ]

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
sin1 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:

dB  10 log10J A2Tb ]


|
⎝ 2 ]
|  dB

210 10
A
Tb

5. Signal Generation Using FSK and PSK


Using the aforementioned techniques for FSK and PSK modulation, we are able to
generate the following transmission signals.
Random Binary FSK Signal
0.5

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

Figure 3: Binary FSK Signal

Random Binary PSK Signal


0.5

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

Figure 4: Binary PSK Signal

6. Shift-Keying Signals with Gaussian Noise


Adding zero-mean Gaussian white noise to the previously generated signals yields the
following results.
FSK + Noise
3

Amplitude

-1

-2

-3
0 10 20 30 40 50 70 80 90 100
60
Time

Figure 5: Noisy FSK Signal

PSK + Noise
3

1
Amplitude

-1

-2

-3
0 10 20 30 40 50 70 80 90 100
60
Time

Figure 6: Noisy PSK Signal

7. Filtering and Decoding

The optimum receiver is of the form h(t)  p T  t  , where p t   s1 t   s2 t  . This

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.

8. Results and Discussion


It was found in this experiment that as the signal to noise ratio increases, the amount of
error present in the optimum receiver is greatly reduced. This is of course expected as
noise power will play less of a role in affecting the signal arriving at the receiver.
Additionally, from the graphs which follow, it can be seen that the performance of PSK
against FSK reduces further the probability of bit error detection by as much as 9%. This
is especially evident at lower values of signal to noise ratios. Furthermore, the power
required by phase shift-keying is less than that of frequency shift-keying modulation and
detection schemes.

The following graphs demonstrate the results of this experiment.


Performance of FSK vs PSK
0
10
FSK

PSK
Bit Error Rate

-1
10

-2
10
-4 -3 -2 -1 0 1 2 3 4
SNR

Figure 7: Bit Error Rates of FSK and PSK vs SNR


Error Rate Reduction, PSK vs FSK
0.1

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

Figure 8: Error Rate Difference, FSK-PSK

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

Figure 9: Theoretical and Experimental FSK Performance


Theoretical and Experimental PSK Perormance
0
10
Theoretical
Experimental

Performance

-1
10

-2
10
-4 -3 -2 -1 0 1 2 3 4
SNR

Figure 10: Theoretical and Experimental PSK Performance


9. Appendix

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

% number of bit errors


err_fsk=0;
err_psk=0;

% decoded output sequences


bko_fsk=zeros(1,bitLength);

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
%**************************************************************************

bk=round(rand(1,bitLength)); %1. generate random binary sequence


A=sqrt(2*eta/Tb*10.^(SNRe/10)); %3. compute A for varying SNR levels

for SNR_loop=1:length(SNRe)
for TRIAL_loop=1:N % 20 independent trials
err_fsk=0;
err_psk=0;

noise=randn(1,bitLength*N); %2. generate zero-mean white Gaussian noise


vi=1;

%**********************************************************************
%** 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

d=length(s1_fsk); % signal duration


%**********************************************************************

for i=1:bitLength %4. generate FSK and PSK mod signals


if(bk(i)==1) % virtual index
s_fsk(vi:vi+(N-1))=s1_fsk(1:N);
s_psk(vi:vi+(N-1))=s1_psk(1:N);
else
s_fsk(vi:vi+(N-1))=s2_fsk(1:N);
s_psk(vi:vi+(N-1))=s2_psk(1:N);
end
vi=vi+N;
end

v_fsk=s_fsk+noise; %5. generate noisy signals

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);

%6. create matched filters


vo_psk=conv(v_psk,mf_psk);
and corresponding signal
through each
% adjustment for detection
vo_fsk=vo_fsk(1:bitLength*N);

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(vo_psk(m)<=0) % PSK detection


bko_psk(m)=0;
else
bko_psk(m)=1;
end
end

%8. find bit error rates


for m=1:bitLength;
if(bk(m)~=bko_fsk(m))
err_fsk=err_fsk+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

fprintf(' Bit Error Rates, SNR=%ddB\n',SNRe(SNR_loop));


fprintf(' FSK: \t%.4f\n',mean(ber_fsk));
fprintf(' PSK: \t%.4f\n',mean(ber_fsk));

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
%************************************
**********************************

You might also like