help me insert rs encoder and decoder to BPSK program

clc;clear;close all;warning off;
M = 8; % Modulation order
bps = log2(M); % Bits per symbol
N = 7; % RS codeword length
K = 5; % RS message length
%input bits
x=randi(1,1000);
%Mapping
for i=1:length(x)
if x(i)==1
data = randi([0 1],1500,1);
xmod(i)=1;
else
xmod(i)=-1;
end
end
ber_sim=[];
for snr=0:2:20
y=awgn(complex(xmod),snr);
for i=1:length(y)
if y(i)>=0
det(i)=1;
else
det(i)=0;
end
end
[noe ber]=biterr(x,det);
ber_sim=[ber_sim ber];
end
snr=0:2:20;
semilogy(snr,ber_sim,'k*-','linewidth',2);hold on
grid on;
xlabel('SNR (dB)-->');
ylabel('BER-->');

Réponses (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by