## 9.2. Solved exercises

EXERCISE 9.1.

A digital signal containing 20 binary elements is transmitted on a communication channel. This signal has the following characteristics:

• – binary rate: 1000 symbols/s,
• – sampling frequency: 10 kHz,
• – symbol duration: 1 ms,
• – code: unipolar without return to zero.

1. Using the function subplot plot the signal, the matched filter impulse response and its output signal. Define the decision threshold and the optimal decision moments.

```Rb = 1000; % binary rate
fs = 10000; % sampling frequency
Ts = 1/fs;  % sampling period
Tb = 1/Rb;  % binary element duration
sequence=[0 1 1 1 0 1 0 0 1 0 1 1 1 0 1 0 0 1 0 1];
no= length(sequence);  % number of bits
no_ech = no * Tb/Ts;   % number of samples
t = [0:(no_ech-1)]*Ts; % sampling moments
pulse =ones(1,fs/Rb);  % waveform (unipolar without return to zero)
x=(sequence'*pulse)';  % signal generation
x=x (:);
t_time = Ts * [0:no_ech];
figure
subplot(311);
plot(t_time,[x;0] );
axis([0 0.021 0 1.2]);grid
title('Bandbase signal')
g = (pulse);
h = g(length(g):-1:1); % matched filter impulse response
subplot(312);
plot([0:size(h,2)+1]*Ts,[h 1 0]);
axis([0 0.021 0 1.2]),grid
title('Matched filter impulse response')
y_fil = conv(h,x) ;    % matched filter output signal
y_fil = [y_fil( :)' 0];
subplot(313);
plot([0:size(y_fil,2)]*Ts, [0 y_fil]) ;
axis([0 0.021 0 1.2*max(y_fil)]);grid
xlabel('Time [s]');
title('Matched filter output signal')```

Figure 9.1. Input signal, matched filter impulse response and its output signal ...

Get Digital Signal Processing Using Matlab now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.