Assume a baseband transmission scheme that sends a stream of binary rectangular
ID: 1770307 • Letter: A
Question
Assume a baseband transmission scheme that sends a stream of binary rectangular pulses of height A = ±1 V (assume that the positive pulse represents a binary 1 and the negative pulse represents a binary 0). This is the polar or antipodal signaling. The transmitted signal is contaminated by additive noise (the noise is added to the signal). For the detection scheme, we will assume that the noise has zero mean. The noise process you will generate will have a nonzero mean. However, you will use the mean and variance estimators to determine an estimate of the mean and the variance using the generated noise with no signal transmitted (see the D section of module 8). You will then subtract the estimated mean from the noise process rendering it zero-mean (approximately). You will then use a detector to decide whether a 0 or a 1 was transmitted over a string of bits whose length will be specified the same for everybody. You will compare the received string and the transmitted string to determine the number of errors thereby allowing you to determine an estimate of the average probability of error. The transmitted string will be made of as many 0s as 1s if we assume that the a-priori probability of a 1 or a 0 is 1/2. If the a-priori probability of a 0 is 0.3, then out of 10 bits, 3 of them will be 0s. These numbers may make sense only if the string is very long but we will work with these given parameters.
Explanation / Answer
Part 1 related figure is generated for laplacian density function using program 2.
Part2 : Gaussian noise case: Number of bit error for given data is around 3.15 for both equal and unequal probabilities when the variance 1. The number of bit generated using equal probability distribution and unequal probability distribution is very less. We do not find any difference for the given data.
Number of bit error for given data is 0 when we sample the data 100 times for both equal and unequal probabilities. It is due to averaging. While averaging, the noise is cancelled because the mean value of noise is zero.
Laplacian noise case: Number of bit error for given data is around 2.45 for both equal and unequal probability data when variance is 1. The error is less compared to Gaussian noise because the density of laplacian noise variable falls sharply when we move away from mean.
Similarly, the number of bit error is 0 when we sample 100 times for both equal and unequal probability data when variance is 0.1.
Demarkation line separates individual MATLAB programs and the program list is as follows:
1) Generation of gaussian noise data and plot its density function using histogram
2) Generation of laplacian noise data and plot its density function using histogram
3) Calculation of bit error for gaussian noise zero mean and variance = 1 with equal probability data
4) Calculation of bit error for gaussian noise zero mean and variance = 0.1 with equal probability data
5) Calculation of bit error for laplacian noise zero mean and variance = 1 with equal probability data
6) Calculation of bit error for laplacian noise zero mean and variance = 0.1 with equal probability data
7) Calculation of bit error for gaussian noise zero mean and variance = 1 with unequal probability data
8) Calculation of bit error for gaussian noise zero mean and variance = 0.1 with unequal probability data
9) Calculation of bit error for laplacian noise zero mean and variance = 1 with unequal probability data
10) Calculation of bit error for laplacian noise zero mean and variance = 0.1 with unequal probability data
------------------------------------------------------------------------------------------------------------------
% Generation of gaussian random variable with mean = 0 and variance = 1
% Generate 1 million random points, here variable 'x' has gaussian noise
x = randn(1000000,1);
% Create an 100 bin histogram, cx has number of noisy data and bx has bin center
[cx,bx] = hist(x,100);
% Normalize the count of noisy samples in each bin
cx = cx/1000000;
figure(1),plot(bx,cx,'LineWidth',2)
% Generation of gaussian random variable with mean = 0 and variance = 0.1
% Generate 1 million random points
x = 0.1*randn(1000000,1);
% Create an 100 bin histogram, cx has number of noisy data and bx has bin center
[cx,bx] = hist(x,100);
% Normalize the count of noisy samples in each bin
cx = cx/1000000;
% plotting the variance = 0.1 on the same plot
hold on,plot(bx,cx,'k-','LineWidth',2)
title('Gaussian density function')
legend('Variance = 1','Variance = 0.1')
grid on
-------------------------------------------------------------------------------------------------------------------
% Generation of laplacian random variable with mean = 0 and variance = 1
% Generate 1 million random points, here variable 'x' has gaussian noise
x = laprnd(1000000,1,0,1);
% Create an 100 bin histogram, cx has number of noisy data and bx has bin center
[cx,bx] = hist(x,100);
% Normalize the count of noisy samples in each bin
cx = cx/1000000;
figure(2),plot(bx,cx,'LineWidth',2)
% Generation of laplacian random variable with mean = 0 and variance = 0.1
% Generate 1 million random points
x = laprnd(1000000,1,0,0.1);
% Create an 100 bin histogram, cx has number of noisy data and bx has bin center
[cx,bx] = hist(x,100);
% Normalize the count of noisy samples in each bin
cx = cx/1000000;
% plotting the variance = 0.1 on the same plot
hold on,plot(bx,cx,'k-','LineWidth',2)
title('Laplacian density function')
legend('Variance = 1','Variance = 0.1')
grid on
--------------------------------------------------------------------------------------------------------------------------------
% Equal probability data, gaussian noise variance = 1
data = [1 0 0 0 1 1 0 0 0 1 0 1 1 1 1 0 1 0 0 1];
modulatedData = data;
% Change zeros to -1
i = find(data==0);
for j=1:length(i)
modulatedData(i(j)) = -1;
end
% Only one sample is recorded
numberBitError = 0;
bitErrorRate = 0;
numSamples = size(data,2);
% Run the process for 10000 times
for k=1:10000;
noise = randn(1,numSamples);
receivedData = modulatedData + noise;
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError = numberBitError + num1;
bitErrorRate = bitErrorRate + rat1;
end
avgBitError = numberBitError/10000;
avgBitErrorRate = bitErrorRate/10000;
% When 100 samples are recorded
for k=1:numSamples
modulatedData100(100*(k-1)+1:100*k) = modulatedData(k);
end
numberBitError100 = 0;
bitErrorRate100 = 0;
numSamples100 = size(modulatedData100,2);
% Run the program for 10000 times
for k=1:10000;
% noise = laprnd(1,numSamples100,0,1);
noise = randn(1,numSamples100);
receivedData100 = modulatedData100 + noise;
% Perform averaging of 100 samples
for j=1:numSamples
receivedData(j) = mean(receivedData100(100*(j-1)+1:100*j));
end
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError100 = numberBitError100 + num1;
bitErrorRate100 = bitErrorRate100 + rat1;
end
avgBitError100 = numberBitError100/10000;
avgBitErrorRate100 = bitErrorRate100/10000;
--------------------------------------------------------------------------------------------------------------
% Equal probability data, gaussian noise variance = 0.1
data = [1 0 0 0 1 1 0 0 0 1 0 1 1 1 1 0 1 0 0 1];
modulatedData = data;
% Change zeros to -1
i = find(data==0);
for j=1:length(i)
modulatedData(i(j)) = -1;
end
% Only one sample is recorded
numberBitError = 0;
bitErrorRate = 0;
numSamples = size(data,2);
% Run the program for 10000 times
for k=1:10000;
noise = 0.1*randn(1,numSamples);
receivedData = modulatedData + noise;
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError = numberBitError + num1;
bitErrorRate = bitErrorRate + rat1;
end
avgBitError = numberBitError/10000;
avgBitErrorRate = bitErrorRate/10000;
% When 100 samples are recorded
for k=1:numSamples
modulatedData100(100*(k-1)+1:100*k) = modulatedData(k);
end
numberBitError100 = 0;
bitErrorRate100 = 0;
numSamples100 = size(modulatedData100,2);
% Run the program for 10000 times
for k=1:10000;
% noise = laprnd(1,numSamples100,0,1);
noise = randn(1,numSamples100);
receivedData100 = modulatedData100 + noise;
% Perform averaging of 100 samples
for j=1:numSamples
receivedData(j) = mean(receivedData100(100*(j-1)+1:100*j));
end
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError100 = numberBitError100 + num1;
bitErrorRate100 = bitErrorRate100 + rat1;
end
avgBitError100 = numberBitError100/10000;
avgBitErrorRate100 = bitErrorRate100/10000;
----------------------------------------------------------------------------------------------
% Equal probability data, laplacian noise variance = 1
data = [1 0 0 0 1 1 0 0 0 1 0 1 1 1 1 0 1 0 0 1];
modulatedData = data;
% Change zeros to -1
i = find(data==0);
for j=1:length(i)
modulatedData(i(j)) = -1;
end
% Only one sample is recorded
numberBitError = 0;
bitErrorRate = 0;
numSamples = size(data,2);
% Run the program for 10000 times
for k=1:10000;
noise = laprnd(1,numSamples,0,1);
receivedData = modulatedData + noise;
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError = numberBitError + num1;
bitErrorRate = bitErrorRate + rat1;
end
avgBitError = numberBitError/10000;
avgBitErrorRate = bitErrorRate/10000;
% When 100 samples are recorded
for k=1:numSamples
modulatedData100(100*(k-1)+1:100*k) = modulatedData(k);
end
numberBitError100 = 0;
bitErrorRate100 = 0;
numSamples100 = size(modulatedData100,2);
% Run the program for 10000 times
for k=1:10000;
% noise = laprnd(1,numSamples100,0,1);
noise = randn(1,numSamples100);
receivedData100 = modulatedData100 + noise;
for j=1:numSamples
receivedData(j) = mean(receivedData100(100*(j-1)+1:100*j));
end
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError100 = numberBitError100 + num1;
bitErrorRate100 = bitErrorRate100 + rat1;
end
avgBitError100 = numberBitError100/10000;
avgBitErrorRate100 = bitErrorRate100/10000;
------------------------------------------------------------------------------------------------------
% Equal probability data, laplacian noise variance = 0.1
data = [1 0 0 0 1 1 0 0 0 1 0 1 1 1 1 0 1 0 0 1];
modulatedData = data;
% Change zeros to -1
i = find(data==0);
for j=1:length(i)
modulatedData(i(j)) = -1;
end
% Only one sample is recorded
numberBitError = 0;
bitErrorRate = 0;
numSamples = size(data,2);
% Run the program for 10000 times
for k=1:10000;
noise = laprnd(1,numSamples,0,0.1);
receivedData = modulatedData + noise;
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError = numberBitError + num1;
bitErrorRate = bitErrorRate + rat1;
end
avgBitError = numberBitError/10000;
avgBitErrorRate = bitErrorRate/10000;
% When 100 samples are recorded
for k=1:numSamples
modulatedData100(100*(k-1)+1:100*k) = modulatedData(k);
end
numberBitError100 = 0;
bitErrorRate100 = 0;
numSamples100 = size(modulatedData100,2);
% Run the program for 10000 times
for k=1:10000;
% noise = laprnd(1,numSamples100,0,1);
noise = randn(1,numSamples100);
receivedData100 = modulatedData100 + noise;
for j=1:numSamples
receivedData(j) = mean(receivedData100(100*(j-1)+1:100*j));
end
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError100 = numberBitError100 + num1;
bitErrorRate100 = bitErrorRate100 + rat1;
end
avgBitError100 = numberBitError100/10000;
avgBitErrorRate100 = bitErrorRate100/10000;
-------------------------------------------------------------------------------------------
% Unequal probability data, gaussian noise variance = 1
data = [1 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1];
modulatedData = data;
% Change zeros to -1
i = find(data==0);
for j=1:length(i)
modulatedData(i(j)) = -1;
end
% Only one sample is recorded
numberBitError = 0;
bitErrorRate = 0;
numSamples = size(data,2);
% Run the process for 10000 times
for k=1:10000;
noise = randn(1,numSamples);
receivedData = modulatedData + noise;
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError = numberBitError + num1;
bitErrorRate = bitErrorRate + rat1;
end
avgBitError = numberBitError/10000;
avgBitErrorRate = bitErrorRate/10000;
% When 100 samples are recorded
for k=1:numSamples
modulatedData100(100*(k-1)+1:100*k) = modulatedData(k);
end
numberBitError100 = 0;
bitErrorRate100 = 0;
numSamples100 = size(modulatedData100,2);
% Run the program for 10000 times
for k=1:10000;
noise = randn(1,numSamples100);
receivedData100 = modulatedData100 + noise;
% Perform averaging of 100 samples
for j=1:numSamples
receivedData(j) = mean(receivedData100(100*(j-1)+1:100*j));
end
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError100 = numberBitError100 + num1;
bitErrorRate100 = bitErrorRate100 + rat1;
end
avgBitError100 = numberBitError100/10000;
avgBitErrorRate100 = bitErrorRate100/10000;
--------------------------------------------------------------------------------------------------------------
% Unequal probability data, gaussian noise variance = 0.1
data = [1 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1];
modulatedData = data;
% Change zeros to -1
i = find(data==0);
for j=1:length(i)
modulatedData(i(j)) = -1;
end
% Only one sample is recorded
numberBitError = 0;
bitErrorRate = 0;
numSamples = size(data,2);
% Run the program for 10000 times
for k=1:10000;
noise = 0.1*randn(1,numSamples);
receivedData = modulatedData + noise;
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError = numberBitError + num1;
bitErrorRate = bitErrorRate + rat1;
end
avgBitError = numberBitError/10000;
avgBitErrorRate = bitErrorRate/10000;
% When 100 samples are recorded
for k=1:numSamples
modulatedData100(100*(k-1)+1:100*k) = modulatedData(k);
end
numberBitError100 = 0;
bitErrorRate100 = 0;
numSamples100 = size(modulatedData100,2);
% Run the program for 10000 times
for k=1:10000;
% noise = laprnd(1,numSamples100,0,1);
noise = randn(1,numSamples100);
receivedData100 = modulatedData100 + noise;
% Perform averaging of 100 samples
for j=1:numSamples
receivedData(j) = mean(receivedData100(100*(j-1)+1:100*j));
end
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError100 = numberBitError100 + num1;
bitErrorRate100 = bitErrorRate100 + rat1;
end
avgBitError100 = numberBitError100/10000;
avgBitErrorRate100 = bitErrorRate100/10000;
----------------------------------------------------------------------------------------------
% Unequal probability data, laplacian noise variance = 1
data = [1 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1];
modulatedData = data;
% Change zeros to -1
i = find(data==0);
for j=1:length(i)
modulatedData(i(j)) = -1;
end
% Only one sample is recorded
numberBitError = 0;
bitErrorRate = 0;
numSamples = size(data,2);
% Run the program for 10000 times
for k=1:10000;
noise = laprnd(1,numSamples,0,1);
receivedData = modulatedData + noise;
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError = numberBitError + num1;
bitErrorRate = bitErrorRate + rat1;
end
avgBitError = numberBitError/10000;
avgBitErrorRate = bitErrorRate/10000;
% When 100 samples are recorded
for k=1:numSamples
modulatedData100(100*(k-1)+1:100*k) = modulatedData(k);
end
numberBitError100 = 0;
bitErrorRate100 = 0;
numSamples100 = size(modulatedData100,2);
% Run the program for 10000 times
for k=1:10000;
% noise = laprnd(1,numSamples100,0,1);
noise = randn(1,numSamples100);
receivedData100 = modulatedData100 + noise;
for j=1:numSamples
receivedData(j) = mean(receivedData100(100*(j-1)+1:100*j));
end
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError100 = numberBitError100 + num1;
bitErrorRate100 = bitErrorRate100 + rat1;
end
avgBitError100 = numberBitError100/10000;
avgBitErrorRate100 = bitErrorRate100/10000;
------------------------------------------------------------------------------------------------------
% Unequal probability data, laplacian noise variance = 0.1
data = [1 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1];
modulatedData = data;
% Change zeros to -1
i = find(data==0);
for j=1:length(i)
modulatedData(i(j)) = -1;
end
% Only one sample is recorded
numberBitError = 0;
bitErrorRate = 0;
numSamples = size(data,2);
% Run the program for 10000 times
for k=1:10000;
noise = laprnd(1,numSamples,0,0.1);
receivedData = modulatedData + noise;
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError = numberBitError + num1;
bitErrorRate = bitErrorRate + rat1;
end
avgBitError = numberBitError/10000;
avgBitErrorRate = bitErrorRate/10000;
% When 100 samples are recorded
for k=1:numSamples
modulatedData100(100*(k-1)+1:100*k) = modulatedData(k);
end
numberBitError100 = 0;
bitErrorRate100 = 0;
numSamples100 = size(modulatedData100,2);
% Run the program for 10000 times
for k=1:10000;
% noise = laprnd(1,numSamples100,0,1);
noise = randn(1,numSamples100);
receivedData100 = modulatedData100 + noise;
for j=1:numSamples
receivedData(j) = mean(receivedData100(100*(j-1)+1:100*j));
end
recoveredData = [receivedData >= 0];
[num1,rat1] = biterr(data,recoveredData);
numberBitError100 = numberBitError100 + num1;
bitErrorRate100 = bitErrorRate100 + rat1;
end
avgBitError100 = numberBitError100/10000;
avgBitErrorRate100 = bitErrorRate100/10000;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.