Question: Use the given Matlab code discussed to build an Amplitude Shift Keying (ASK) simulator for the On-Off Keying (OOK) modulation. Once finished, run the simulations

Use the given Matlab code discussed to build an Amplitude Shift Keying (ASK) simulator for the On-Off Keying (OOK) modulation. Once finished, run the simulations required to plot BER curves with a minimum probability of bit?error of 10-4.

%% Main Function

function runComm()

clear;clc;

SNRdB = 20:0.5:30;

nBits = 1e5;

SNRdBLength = length(SNRdB);

Pe = ones(1,SNRdBLength);

clc; disp('Simulation running: 0.0% completed.');

for i = 1:SNRdBLength

Pe(i) = transmitReceive(nBits,SNRdB(i));

clc;fprintf('%s: %.1f%% completed','Simulation running',i/SNRdBLength*100);

end

hold on; semilogy(SNRdB,Pe); grid on;

clc; disp('Simulation finished.');

return

%% Bit Transmission Function

function [Perror,nErrors,TxBits,RxBits] = transmitReceive(nBits,SNRdB)

% TxBits = [0 1 1 0 1 0 0 1 1 1];

nBitsMax = 100000;

nBitsOrig = nBits;

TxBits = [];

RxBits =[];

if(nBits > nBitsMax)

n = ceil(nBits/nBitsMax);

nErrorsArr = zeros(1,n);

for i = 1:n

if(nBits < nBitsMax)

[~,nErrorsArr(i),TxBitsTmp,RxBitsTmp] = transmitReceive(nBits,SNRdB);

TxBits = [TxBits,TxBitsTmp];

RxBits = [RxBits,RxBitsTmp];

break;

else

[~,nErrorsArr(i),TxBitsTmp,RxBitsTmp] = transmitReceive(nBitsMax,SNRdB);

TxBits = [TxBits,TxBitsTmp];

RxBits = [RxBits,RxBitsTmp];

nBits = nBits - nBitsMax;

end

end

nErrors = sum(nErrorsArr);

Perror = nErrors/nBitsOrig;

return;

end

TxBits = round(rand(1,nBits));

TxSignals = modulation(TxBits);

[RxSignals] = addAWGNoise(TxSignals,SNRdB);

RxBits = demodulation(RxSignals);

errorBits = TxBits ~= RxBits;

nErrors = sum(errorBits);

Perror = nErrors/nBits;

return

%% Modulation and Demodulation Functions

function [outSignals,time] = modulation(inBits)

%Your code here

return

function [outBits] = demodulation(inSignals)

%Your code here

return

%% Noise Adding Function

function [outSignals,noiseSignals] = addAWGNoise(signals,SNRdB)

signalsSize = size(signals);

SNR = 10^(SNRdB/10);

Ps = max(sum(signals.^2));

Po = Ps./SNR;

noiseSignals = sqrt(Po/2).*randn(signalsSize(1),signalsSize(2));

outSignals = signals+noiseSignals;

return

%% Signal Creation Functions

function [outSignal,time] = pulseSignal(Tp,Tw,osFactor)

if(nargin == 2), osFactor = 1; end

if(osFactor < 1), osFactor = 1; end

B = 1.5/Tp;

fs = osFactor*2*B;

Nw = ceil(fs*Tw);

Np = ceil(fs*Tp);

outSignal = [0; ones(Np,1); zeros(Nw-Np-1,1)];

outSignal(end)=0;

time = (0:length(outSignal)-1)'/fs;

return

function [outSignal] = squareSignal(time,freq)

tsample = time(2)-time(1);

tperiod = 1/freq;

n = ceil(tperiod/tsample);

npos = ceil(n/2);

nneg = n - npos;

Nperiods = ceil(time(end)*freq);

signalTmp = [ones(npos,1); -1*ones(nneg,1)];

outSignal = repmat(signalTmp,Nperiods+1,1);

outSignal = [ 0; outSignal(1:length(time)-1) ];

return

You will need to turn in a report that must include the following:

Plots:

BER vs SNR (dB) plot in the same graph, plot at least 4 BER curves corresponding to different values of symbol periods and pulse widths.

Transmitted signal plot plot the transmitted signal corresponding to 3 bits.

Received signal plots for the transmitted signal (3 bits), plot the received noisy signal for at least 4 values of SNR (e.g. 0 dB, 10 dB, 20 dB, 30 dB).

Content:

Search for information (books, publications, online reliable sources, etc.) and develop a theory section that fully explains your assigned modulation scheme including, but not limited to, the modulation and demodulation processes.

Develop a section of results and analysis. This section must explain the different simulations and present a profound analysis of the results. The plot of BER curves must be included in this section along with any other plots or tables that you consider relevant.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!