1. EDCM Project 2
20-04-2015
Supervisor
John Aasted Sørensen
Head of studies Healthcare Technology,
associate professor
jaas@dtu.dk
Students:
Arlene Meidahl- s107106
Danish Mohammed Ali Bangash - s104712
62532 Digital Communication and
Modulation
(EDCM)
Project 2: Baseband Data Communication
2. EDCM Project 2
20-04-2015
1
1 PART 1: The Eye Diagram for Digital Communication Channel
1.1 Part 1.1: Explain how an eye diagram is generated and the function of an eye
diagram.
An eye diagram is a graphical analysis tool.
It provides analysis of a signal passing through a communication channel.
It provides at-a-glance evaluation of system performance.
It gives a good approximation of signal to noise levels, additive noise, amplitude, and timing jitter,
etc.
Figure 1: Eye Diagram
𝑇𝑗 Timing jitter, which is a perturbation of the zero-crossing of filtered signal.
𝐴𝑗 Amplitude jitter, which is the shrinkage of the eye opening due to ISI.
𝑇𝑠,𝑂𝑝𝑡𝑖𝑚𝑎𝑙 Time to sample (decision point), most open part of the eye.
Eye diagram describes the amount of symbols going into the filter.
3. EDCM Project 2
20-04-2015
2
Depending on the amount of symbols, there will be a number of sine waves to produce
different combinations.
If we look at the figure above there are only two sine waves, the one with twice frequency as
the other
Depending on the frequency of the symbols and the bandwidth𝐵 𝑁, of the filter an eye
diagram will appear. Depending on how small 𝐵 𝑁 is, one will get amplitude variation as 𝐴𝐽 ,
The smaller 𝐵 𝑁 becomes, the bigger will be the 𝐴𝐽 , this is due to the filter attenuating data
flow as the data rate moves closer to 𝑓𝑐 ( cut off frequency )
ISI leads to timing jitter shown as 𝑇𝐽 , the zero crossing drifts due to the ISI.
The slope at zero crossing tells something about the relation between the bandwidth and
dataflow, the higher the bandwidth the higher the slope.
1.1.1 Why using eye diagrams?
To get the idea of how our system works in relation to amount of data going through the system.
Figure: Eye diagram using respective bandwidths and given code (c4ce2.m).
Looking at the figure above we conclude the following:
Larger bandwidths make the eye more open, while smaller bandwidths make the eye more closed,
having distortion also known as amplitude jitter.
Amplitude jitter can be minimized by increasing the bandwidth.
There are differences in zero crossings at the zero threshold level- timing jitter.
Timing jitter can be minimized by increasing the bandwidth.
The best points to sample the signal are the parts where the SNR are the best.
4. EDCM Project 2
20-04-2015
3
1.2 PART 1.2: Explain the code in c4ce2a.m in a great detail then the present
comments. Insert the comments directly in a renamed version of the script.
% File: c4ce2a.m
% Illustration of eye diagrams
%
% Computer Example 4.2 of R. E. Ziemer and W. H. Tranter,
% "Principles of Communications: Systems, Modulation, & Noise"
%
clf
nsym = 1000; nsamp = 50; bw = [0.4 0.6 1 2];
for k = 1:4
lambda = bw(k);
[b,a] = butter(3,2*lambda/nsamp);
l = nsym*nsamp; % Total sequence length
y = zeros(1,l-nsamp+1); % Initalize output vector
x = 2*round(rand(1,nsym))-1; % Components of x = +1 or -1
for i = 1:nsym % Loop to generate info symbols
kk = (i-1)*nsamp+1;
y(kk) = x(i);
end
datavector = conv(y,ones(1,nsamp)); % Each symbol is nsamp long
filtout = filter(b, a, datavector);
datamatrix = reshape(filtout, 4*nsamp, nsym/4);
datamatrix1 = datamatrix(:, 6:(nsym/4));
subplot(4,1,k), plot(datamatrix1, 'k'), ylabel('Amplitude'), ...
axis([0 200 -1.4 1.4]), legend(['{itB_N} = ', num2str(lambda)])
if k == 4
xlabel('{itt/T}_s_a_m_p')
end
end
% End of script file.
1.3 PART 1.3: Explain the channel model, used for demonstrating the eye diagram.
This should include an explanation of normalized bandwidth.
An eye diagram is constructed by plotting the overlapping k-symbol segments of a base band signal.
It can be displayed by triggering the time sweep at times 𝑡 = 𝑛𝑘𝑇𝑠 , where 𝑇𝑠 is the symbol period,
𝑘𝑇𝑠 is the eye period and n is an integer.
Figure: simple technique for generating an eye diagram
5. EDCM Project 2
20-04-2015
4
We consider the eye diagram of a band-limited NRZ (Non return Zero) baseband signal.
The signal is generated by passing a NRZ waveform through a third order Butterworth filter.
The filter bandwidth is normalized to the symbol rate- if the symbol rate of the NRZ wave form is
1000 symbols per second and the normalized filter bandwidth is 0.6 then the filter bandwidth is
600Hz.
1.4 PART 1.4: Augment the present eye diagram demonstrations, generated by
c4ce2a.m with the following channel normalized bandwidths: Bn = 0.1; 0.8; 1.5; 5
Figure: Five Eye Diagrams of the new given bandwidth values
For the purpose of this problem we used the same codes with small changes for the 5 new bandwidth
values (= 0.1; 0.8; 1.5; 5). Codes can be found in the appendix.
6. EDCM Project 2
20-04-2015
5
1.5 PART 1.5: Insert the plot of the original eye diagrams and those in augmented
demonstration in the report and comment on their structure. Specifically it is
commented on the case of very low ISI, very high ISI and the case where the
bandwidth is ~ bit rate.
Figure: Four Eye Diagrams using original bandwidth values
Figure: Five Eye Diagrams of the new given bandwidth values
Above we see a plot of four eye diagrams with original bandwidth values and below that we see a
plot of five eye diagrams with new given bandwidth values.
We observed all nine eye diagrams with different bandwidths.
Hence we have proved that, the smaller the bandwidth, the bigger the amplitude and timing jitters.
The ISI (inter-symbol interfaces) increases and the synchronization becomes more becomes more
difficult for higher bandwidths.
Id we increase the bandwidth, the slope of the zero crossings increases, which makes the eye more
open.
7. EDCM Project 2
20-04-2015
6
1.6 PART 1.6: Insert the modified script file, with appropriate comments, for
generation of the eye diagram as an appendix in the report.
% File: c4ce2a_new_1_4.m
% Illustration of eye diagrams
%
% Computer Example 4.2 of R. E. Ziemer and W. H. Tranter,
% "Principles of Communications: Systems, Modulation, & Noise"
%
clf
nsym = 1000; nsamp = 50; bw = [0.1 0.2 0.8 1.5 5];
for k = 1:5
lambda = bw(k);
[b,a] = butter(3,2*lambda/nsamp);
l = nsym*nsamp; % Total sequence length
y = zeros(1,l-nsamp+1); % Initalize output vector
x = 2*round(rand(1,nsym))-1; % Components of x = +1 or -1
for i = 1:nsym % Loop to generate info symbols
kk = (i-1)*nsamp+1;
y(kk) = x(i);
end
datavector = conv(y,ones(1,nsamp)); % Each symbol is nsamp long
filtout = filter(b, a, datavector);
datamatrix = reshape(filtout, 5*nsamp, nsym/5);
datamatrix1 = datamatrix(:, 6:(nsym/5));
subplot(5,1,k), plot(datamatrix1, 'k'), ylabel('Amplitude'), ...
axis([0 200 -1.4 1.4]), legend(['{itB_N} = ', num2str(lambda)])
if k == 5
xlabel('{itt/T}_s_a_m_p')
end
end
% End of script file.
8. EDCM Project 2
20-04-2015
7
2 PART 2: The Q-Function
2.1 PART 2.1: Plot the normal (Gaussian) probability density function (pdf) and
include the formula for it.
Normal PDF: = 𝑓 𝑥 µ, 𝜍) =
1
2𝜋
𝜍 𝑒
−(𝑥−µ) 2
2𝜍2
, where “µ” is the “mean”,” 𝜍" is “standard deviation”
and “ 𝜍2
" is “variance”.
We used MATLAB to plot the Probability Density Function as illustrated bellow:
Figure 2.1: Normal Gaussian Probability Function
2.2 PART 2.2: Explain the Q(u)-Function in relation to the normal probability
density function.
𝑄 𝑢 =
𝑒−0.5𝑦2
2𝜋
𝑑𝑦
∞
𝑢
- Or generally- 𝑄 𝑢 =
1
2𝜋
𝑒
−𝑦2
2 𝑑𝑦
∞
𝑢
The Q-Function is related to normal probability density function.
The Q-Function is the probability that a normal random variable will obtain a value larger than
standard deviations above the mean.
The figure below shows Gaussians PDF and the red region is the Q-Function.
9. EDCM Project 2
20-04-2015
8
Figure 2.2: Gaussian PDF and the Q-Function
We can compute the Q-Function By Integrating the normal PDF.
𝑝 𝑥 ≥ 𝑢 =
1
2𝜋
𝜍 𝑒
−(𝑥−µ) 2
2𝜍2
𝑝 𝑥 ≥ 𝑢 =
∞
𝑢
1
2𝜋
𝜍 𝑒
−(𝑥−µ) 2
2𝜍2
𝑑𝑢
The Q-Function is the tail probability of the standard normal distribution.
The mean value is “0” and the variance is “1”.
Also 𝑦 =
𝑢−µ
𝜍
, since µ = 0 and σ = 1, then y = u, therefore
𝑑𝑦
𝑑𝑢
= 1 dy = du
That is how we got the general Q- Function formula: 𝑄 𝑢 =
1
2𝜋
𝑒
−𝑦2
2 𝑑𝑦
∞
𝑢
2.3 PART 2.3 Prepare a script file for plotting the Q(u)-Function for arguments
values of relevance to the detection problems for digital communication receivers.
Q-Function’s practical application is finding the bit error probability in digital transmission system,
also called Bit Error Rate: 𝑃𝐸 = 𝑄(
2𝐴2
𝑁0
) ,Where 𝑃𝐸 stands for the probability error
A is the amplitude of transmitted signal, T is symbol period, 𝑁0 is the power spectral density of the
noise in the channel.
We can also check the connection with the energy per bit- 𝐸𝑏𝑖𝑡 :
2𝐴2 𝑇
𝑁0
=
𝐸 𝑏𝑖𝑡
𝑁0
= 𝑧 , and from that we
can find : 𝑃𝐸 = 𝑄( 2𝑧)
We used the built in Q-Function in MATLAB, the figure below is the representation of the built in
Q-Function.
10. EDCM Project 2
20-04-2015
9
Figure 2.3: Q-Function illustrating the Bit Error Probability
Again the figure below illustrates the built in Q-Function, and the Q-Function created by another
expression of the Q-Function
Figure 2.4: Comparison between built in Q-Function and Q-function by Formula
0 2 4 6 8 10 12 14 16 18 20
10
-50
10
-40
10
-30
10
-20
10
-10
10
0
SNR, dB
biterrorprobability,PE
Q-function illustrating bit error probabilitiy
built-in Q-funct y
0 2 4 6 8 10 12 14 16 18 20
10
-50
10
-40
10
-30
10
-20
10
-10
10
0
SNR, dB
biterrorprobability,PE
Comparison of built-in matlab Q-function y and Q-function by formula Q
built-in Q-funct y
Q-funct formula Q
11. EDCM Project 2
20-04-2015
10
When the SNR (Signal to Noise Ratio) increases, the bit error probability decreases.
The bit error probability can take on really wide range of values, therefore it is plotted on the
logarithmic scale.
If we compare the two Q-functions as shown in the figure above, we see that the Q-Function by
another expression (formula) deviates slightly towards the y-axis.
This might be because of the approximated Q-Function: Q u =
1
2π
u e−0.5x2
Is valid for u >> 3.4
2.4 PART 2.4: Insert the Q(u) function script, with the appropriate comments, in an
appendix in the report.
Found in appendix part 2.4
12. EDCM Project 2
20-04-2015
11
3 PART 3: The Matched Filter Receiver
3.1 PART 3.1: Explain the principals of matched filter receiver for binary data for
white Gaussian noise, thus using the so called AWNG model. The description
should include a definition of all the necessary variables in the system and a block
diagram.
Matched filter are used for extracting already known waveforms from a signal, which has been
contaminated with noise.
The matched filter is maximizing the SNR (signal to noise ratio), which minimizes the probability of
receiving undetected errors.
The matched filter is basically a cross-correlation of known signal with some unknown signal, we
detect the presence of known signal in the unknown signal.
The matched filter receiver includes two signals: 𝑠1(𝑡), which represents a logical “0” and 𝑠2(𝑡),
which represents a logical “1”, and additive white Gaussian noise AWGN with power spectral
density 𝑛 𝑡 =
1
2𝑁0
Figure 3.1: Possible receiver structure for detecting binary signals in AWGN
The filter has impulse response h (t) and corresponding frequency response function H(f).
Depending on the threshold, 𝑠1 𝑡 𝑜𝑟 𝑠2(𝑡) was sent at the output.
Figure 3.2: Matched filter receiver for binary signal in AWGN.
The figure above has two filters, the impulse response for those filters are equal to the time reverse
of the respective signals being detected.
Energies of 𝑠1 𝑡 and 𝑠2(𝑡) – respectively 𝐸1 and 𝐸2, and average energy per signal bit –E: 𝐸1 =
𝑆1
2𝑇
0
𝑡 𝑑𝑡 and 𝐸2 = 𝑆2
2𝑇
0
𝑡 𝑑𝑡 and 𝐸 =
1
2
(𝐸1 + 𝐸2)
E is true, assuming that 𝑠1 𝑡 and 𝑠2 𝑡 were sent with equally probability, 𝑠1 𝑡 , 𝑠2 𝑡 0 ≤ 𝑡 < 𝑇
Correlation coefficient between the two waveforms 𝑠1 𝑡 and 𝑠2(𝑡): 𝜌12 =
1
𝐸1 𝐸2
𝑠1 𝑡 𝑠2(𝑡)𝑑𝑡
∞
𝑢
and −1 ≤ 𝜌12 ≤ 1
13. EDCM Project 2
20-04-2015
12
And we define 𝑅12 =
𝐸1 𝐸2
2
𝐸1+ 𝐸2
𝜌12 =
𝐸1 𝐸2
𝐸
𝜌12
The bit error probability of a matched filter (the bit error rate of binary channel with AWGN) is :
𝑃𝐸 = 𝑄( 𝑍(1 − 𝑅12)), where Q is the Gaussian Q-Function 𝑄 𝑢 =
1
2𝜋
𝑒−
1
2
𝑥2∞
𝑢
𝑑𝑥
And by definition we have: 𝐾𝑜𝑝𝑡 =
1
2
𝑠01 𝑇 + 𝑠02 𝑇 ,
𝐾𝑜𝑝𝑡 = 𝑜𝑝𝑡𝑖𝑚𝑎𝑙 𝑡𝑟𝑒𝑜𝑙𝑑, 𝑆0 = 𝑠𝑖𝑔𝑛𝑎𝑙 𝑜𝑢𝑝𝑢𝑡 for 𝐸1 = 𝐸2: 𝐾𝑜𝑝𝑡 = 0
The SNR (signal to noise ratio) is given as 𝑧 =
𝐸
𝑁0
3.2 PART 3.2: Explain the code in c8ce1a.m in greater detail then the present
comments. Insert the comments directly in a renamed version of the script.
Found in appendix 3.2
3.3 PART 3.3: Create the matlab function qfn called form c8ce1a.m according to the
matlab code shown in [Ziemer, 2010] page 400.
The book suggests the following computation of the Gaussian Q-Function:
function Q = qfn(x)
Q = 0.5*erfc (x/sqrt (2));
𝑄 𝑥 =
1
2
𝑒𝑟𝑓𝑐(
𝑥
2
) Is the MATLAB complementary error function.
It is defined mathematically as : 𝐸 𝑥 =
2
𝜋
𝑒−𝑡2∞
𝑢
𝑑𝑡
We have the Gaussian Q-function as mentioned earlier: 𝑄 𝑢 =
1
2𝜋
𝑒−
1
2
𝑥2∞
𝑢
𝑑𝑥
The function qfn could simply be done by using the built-in Q-Function in MATLAB
function Q = qfn (x)
Q = qfunc (x);
14. EDCM Project 2
20-04-2015
13
3.4 PART 3.4: Extend the code in c8ce1a.m such that the number of input
correlations can be up to 6. Presently 4 is the maximum of input arguments.
Found in Appendix. PART 3.4
3.5 PART 3.5: Apply the following correlation coefficients in the c8ce1a script [-1 -
0.5 0 0.5 0.8 0.995] and insert the resulting plot in the project report. Explain the
plot and verify that it is correct.
We enter up to 6 correlation coefficients, and qfn function is the Gaussian Q-Function.
We used above mentioned coefficients and to get the plot of bit error probability as a function of
specific correlation coefficients.
Figure 3.5: Plot of bit error probability as a function of specific correlation coefficients
The x-axis shows the ratio of signal energy per pulse to single sided noise power spectral density
The y-axis represents the bit error probability.
We have the minimum value of the bit error probability 𝑃𝐸 when 𝜌12 = −1
𝜌12 is directly related to 𝑅12 (which is 𝑅12 =
𝐸1 𝐸2
𝐸
𝜌12 as mentioned earlier)
So the minimum value for 𝑅12 = -1
We conclude that if we increase the correlation between the two signals,𝑠1 𝑡 𝑎𝑛𝑑 𝑠2(𝑡), then the bit
error probability 𝑃𝐸 increases as well
15. EDCM Project 2
20-04-2015
14
3.6 PART 3.6: Explain how a matched-filter receiver can be implemented by a
correlator. The explanation should include the most important formulas leading
to the matched filter implementation using a cross-correlation.
We have already been through the experience of implementing the matched filter receiver using two
filters (Part 3.1) with impulse response equal to the time reverse of the respective signals being
detected.
The receiver can be obtained by the matched filter, in the figure(a) below it can be replaced by a
multiplier-integrator-cascade –the figure(b).
Such a series of operation is referred to as correlation detection:
Using the figure(b) above, we can implement a matched filter receiver for binary data in AWGN by
using cross correlation as shown in the figure below:
To have matched filter with correlator, the variable v’(T) has to be equal to v(T) from part 3.1:
𝑣 𝑇 = 𝑡 ∗ 𝑦 𝑡 = 𝑠 𝑇 − 𝑡 𝑦 𝑡 − 𝜏 𝑑𝜏 , 𝑤𝑒𝑟𝑒
𝑡 = 𝑠 𝑇 − 𝑡 𝑓𝑜𝑟 0 ≤ 𝑡 ≤ 𝑇
0 𝑜𝑡𝑒𝑟𝑤𝑖𝑠𝑒
𝑇
0
16. EDCM Project 2
20-04-2015
15
Let t = T and changing the value in integrand to α = T – τ, we obtain : 𝑣 𝑇 = 𝑠 𝛼 𝑦 𝛼 𝑑𝛼
𝑇
0
Considering the output of the correlator configuration, we obtain: 𝑣′
𝑇 = 𝑦 𝑡 𝑠 𝑡 𝑑𝑡
𝑇
0
, which is
identical to v(T).
That shows that the matched filters for 𝑠1 𝑡 𝑎𝑛𝑑 𝑠2 𝑡 from part 3.1 can be replaced by correlation
operation with 𝑠1 𝑡 𝑎𝑛𝑑 𝑠2 𝑡 respectively, and the receiver operation will not be changed.
17. EDCM Project 2
20-04-2015
16
Appendix:
Part 1.2
% File: c4ce2a.m
% Illustration of eye diagrams
%
% Computer Example 4.2 of R. E. Ziemer and W. H. Tranter,
% "Principles of Communications: Systems, Modulation, & Noise"
%
clf
nsym = 1000; nsamp = 50; bw = [0.4 0.6 1 2];
for k = 1:4
lambda = bw(k);
[b,a] = butter(3,2*lambda/nsamp);
l = nsym*nsamp; % Total sequence length
y = zeros(1,l-nsamp+1); % Initialize output vector
x = 2*round(rand(1,nsym))-1; % Components of x = +1 or -1
for i = 1:nsym % Loop to generate info symbols
kk = (i-1)*nsamp+1;
y(kk) = x(i);
end
datavector = conv(y,ones(1,nsamp)); % Each symbol is nsamp long
filtout = filter(b, a, datavector);
datamatrix = reshape(filtout, 4*nsamp, nsym/4);
datamatrix1 = datamatrix(:, 6:(nsym/4));
subplot(4,1,k), plot(datamatrix1, 'k'), ylabel('Amplitude'), ...
axis([0 200 -1.4 1.4]), legend(['{itB_N} = ', num2str(lambda)])
if k == 4
xlabel('{itt/T}_s_a_m_p')
end
end
% End of script file.
Part 1.6
% File: c4ce2a_new_1_4.m
% Illustration of eye diagrams
%
% Computer Example 4.2 of R. E. Ziemer and W. H. Tranter,
% "Principles of Communications: Systems, Modulation, & Noise"
%
clf
nsym = 1000; nsamp = 50; bw = [0.1 0.2 0.8 1.5 5];
for k = 1:5
lambda = bw(k);
[b,a] = butter(3,2*lambda/nsamp);
l = nsym*nsamp; % Total sequence length
y = zeros(1,l-nsamp+1); % Initialize output vector
x = 2*round(rand(1,nsym))-1; % Components of x = +1 or -1
for i = 1:nsym % Loop to generate info symbols
kk = (i-1)*nsamp+1;
y(kk) = x(i);
end
datavector = conv(y,ones(1,nsamp)); % Each symbol is nsamp long
filtout = filter(b, a, datavector);
datamatrix = reshape(filtout, 5*nsamp, nsym/5);
datamatrix1 = datamatrix(:, 6:(nsym/5));
subplot(5,1,k), plot(datamatrix1, 'k'), ylabel('Amplitude'), ...
axis([0 200 -1.4 1.4]), legend(['{itB_N} = ', num2str(lambda)])
if k == 5
xlabel('{itt/T}_s_a_m_p')
end
end
% End of script file.
18. EDCM Project 2
20-04-2015
17
Part 2.1
%% Part 2.1
my = 0.2; sigma = 0.1;
x = linspace (my-4*sigma, my+4*sigma);
figure(1)
plot(x, normpdf (x,my,sigma), 'r')
hold on
title('Normal (Gaussian) probability density function')
xlabel('x')
ylabel('n(mu,sigma)')
hold off
%print -dmeta proj2_problem_2_1_fig.emf
Part 2.4
% Part 2.3 Plotting Q-function; illustrates bit error probability
u=0:0.01:30; % SNR values vector in dB
y = qfunc(u); % Q-function in matlab
Q=1./(u.*sqrt(2*pi)).*exp(-0.5.*u.^2); % other expression of the Q-function
% plotting the Q-function - using semi logy, which is a semi-log y-axis scale plot
% - it is the same as plot(...), but it has logarithmic (base 10) scale for
% the y-axis:
figure(2)
semilogy(u, y),axis([0 20 10^(-50) 10^(5)]),...
xlabel('SNR, dB'),...
ylabel('Bit Error Probability, P_E'),...
title ('Q-function illustrating bit error probabilitiy');
% plotting the Q-function:
figure(3)
semilogy(u, y),axis([0 20 10^(-50) 10^(5)]),...
xlabel('SNR, dB'),...
ylabel('Bit Error Probability, P_E'),...
hold on
semilogy(u, Q, 'r'),axis([0 20 10^(-50) 10^(5)]),...
xlabel('SNR, dB'),...
ylabel('bit error probability, P_E'),...
suptitle('Comparison of built-in matlab Q-function y and Q-function by formula Q')
legend('built-in Q-funct y', 'Q-funct formula Q')
hold off
Part 3.2
% file: proj2_c8ce1a_new_3_2.m
% Bit error probabilities for binary signaling
%
% Computer Example 8.1 of R. E. Ziemer and W. H. Tranter,
% "Principles of Communications: Systems, Modulation, & Noise"
%
% User defined subprogram qfn( ) called
%
clf % clear 'current figure' window
% input vector with integer values by typing "[N N N N]":
R12 = input('Enter vector of desired R_1_2 values; maximum of 4 ');
% convert to character array (string); forms character array A:
A = char('-','-.',':','--');
19. EDCM Project 2
20-04-2015
18
k=1; % initializing k to be equal to 1
LR = length(R12); % length of vector R12
z_dB = 0:.3:15; % Vector of desired values of Eb/N0 in dB
z = 10.^(z_dB/10); % converting dB to ratio
for k = 1:LR % Loop for various values of R12 (length)
% bit error probability for a vector with z values (explaination Part3.1):
P_E=qfn(sqrt(z*(1-R12(k))));
% plotting data with log scale for x and y-axis:
semilogy(z_dB,P_E,A(k,:)),axis([0 15 10^(-6) 1]),xlabel('E_b/N_0, dB'),ylabel('P_b'),...
title('Bit error probability for binary signaling with normalized correlation R_1_2 between
signals')
if k==1 % do next commands if condition k==1 fulfilled
hold on
grid
end
end
% Put appropriate legend on graph, depending on number of R12 values chosen
% if and elseif conditions depending on the length of the R12 vector
if LR == 1
% legend shows text label specified, line type, marker symbol, color
% for plotted line:
legend(['R_1_2 = ',num2str(R12(1))],1)
elseif LR == 2
% vector R12 converted into string representation:
legend(['R_1_2 = ',num2str(R12(1))],['R_1_2 = ',num2str(R12(2))],1)
elseif LR == 3
legend(['R_1_2 = ',num2str(R12(1))],['R_1_2 = ',num2str(R12(2))],['R_1_2 = ',num2str(R12(3))],1)
elseif LR == 4
legend(['R_1_2 = ',num2str(R12(1))],['R_1_2 = ',num2str(R12(2))],['R_1_2 =
',num2str(R12(3))],['R_1_2 = ',num2str(R12(4))],1)
end
% End of script file
Part 3.4
% file: proj2_c8ce1a_new_3_4.m
% Bit error probabilities for binary signaling
%
% Computer Example 8.1 of R. E. Ziemer and W. H. Tranter,
% "Principles of Communications: Systems, Modulation, & Noise"
%
% User defined subprogram qfn( ) called
%
clf % clear 'current figure' window
% input vector with integer values by typing "[N N N N]":
R12 = input('Enter vector of desired R_1_2 values; maximum of 6 ');
% convert to character array (string); forms character array A:
A = char('-','-.',':','--','pr-.','pr-');
k=1; % initializing k to be equal to 1
LR = length(R12); % length of vector R12
z_dB = 0:1:50; % Vector of desired values of Eb/N0 in dB
z = 10.^(z_dB/10); % converting dB to ratio
for k = 1:LR % Loop for various values of R12 (length)
% bit error probability for a vector with z values (explaination Part3.1):
P_E=qfn(sqrt(z*(1-R12(k))));
% plotting data with log scale for x and y-axis:
semilogy(z_dB,P_E,A(k,:)),axis([0 15 10^(-10) 1]),xlabel('E_b/N_0, dB'),ylabel('P_b'),...
title('Bit error probability for binary signaling with normalized correlation R_1_2 between
signals')
if k==1 % do next commands if condition k==1 fulfilled
hold on
grid
end
end
% Put appropriate legend on graph, depending on number of R12 values chosen
% if and elseif conditions depending on the length of the R12 vector
if LR == 1
20. EDCM Project 2
20-04-2015
19
% legend shows text label specified, line type, marker symbol, color
% for plotted line:
legend(['R_1_2 = ',num2str(R12(1))],1)
elseif LR == 2
% vector R12 converted into string representation:
legend(['R_1_2 = ',num2str(R12(1))],['R_1_2 = ',num2str(R12(2))],1)
elseif LR == 3
legend(['R_1_2 = ',num2str(R12(1))],['R_1_2 = ',num2str(R12(2))],['R_1_2 = ',num2str(R12(3))],1)
elseif LR == 4
legend(['R_1_2 = ',num2str(R12(1))],['R_1_2 = ',num2str(R12(2))],['R_1_2 =
',num2str(R12(3))],['R_1_2 = ',num2str(R12(4))],1)
elseif LR == 5
legend(['R_1_2 = ',num2str(R12(1))],['R_1_2 = ',num2str(R12(2))],['R_1_2 =
',num2str(R12(3))],['R_1_2 = ',num2str(R12(4))],['R_1_2 = ',num2str(R12(5))],1)
elseif LR == 6
legend(['R_1_2 = ',num2str(R12(1))],['R_1_2 = ',num2str(R12(2))],['R_1_2 =
',num2str(R12(3))],['R_1_2 = ',num2str(R12(4))],['R_1_2 = ',num2str(R12(5))],['R_1_2 =
',num2str(R12(6))],1)
end
% End of script file
Reference:
[Ziemer, 2010] Principles of Communications. Systems, Modulation, and Noise. Rodger E. Ziemer,
William H. Tranter