I must make this code output a correct Bit Error Rate vs SNR

I must make this code output a correct Bit Error Rate vs. SNR graph for BPSK modulation in MATLAB:

clear all; close all;
%M modulation level, M=2, BPSK, M=4, QPSK, M=16, MQAM
N = 16; Fd = 1; Fs = N * Fd; Delay = 3; Symb = 100; M = 2;

%Signal Modulation
msg_orig = randsrc(Symb,1,[0:M-1]); %random vector

%BPSK Modulator
H = comm.BPSKModulator;
K = comm.BPSKDemodulator;
msg_tx2 = step(H,msg_orig);
[y2, t2] = rcosflt(msg_tx2, Fd, Fs);

SNR1 = 0;
while SNR1<20
sig_rx1 = awgn(msg_tx2,SNR1);
%raise cosine filter
[fsig_rx2, t2] = rcosflt(sig_rx1, Fd, Fs);
rxData = step(K,sig_rx1);
%time domain data, with ISI
[numbers,ratio] = biterr(msg_orig,rxData)
plot(SNR1, ratio,\'bo\');
hold on
SNR1 = SNR1 +3;
end

The result is suppose to look like the magenta line below:

The current code isn\'t outputting this result. Why doesn\'t the code work?

Perbrmance ofBaseband QPSK Theoretical SER Theoretical BER Simulated SER Simulated BER EblNo (dB)

Solution

Code is correct but your licensed matlab should support the following functions:

comm.BPSKModulator;
comm.BPSKDemodulator

These two function are used for modulations which are not supposed to work in all computers.

You found errors means your computer may not support these functions.

You can check in your matlab by typing following commands in command prompt.

help comm.BPSKModulator

If you get any data then your computer supports otherwise it shows \" comm.BPSKModulator not found. \" Similarly you can check remaining functions.

I must make this code output a correct Bit Error Rate vs. SNR graph for BPSK modulation in MATLAB: clear all; close all; %M modulation level, M=2, BPSK, M=4, QP

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site