# Ber Simulation for Reed-Solomon Codes in Matlab

Started by August 12, 2009
```Hello all, please i need urgent help
I have used the inbuilt matlab functions as described in matlab for Reed
Solomon and Convolutional codes. I have a binary file that i want to
simulate using an awgn and a mobile channel. Ineed to calculate the ber and
(EbNo) plot them on a graph. But the noisy signal i get after adding awgn
to the code cannot be decoded by Reed Solomon decoder since it is not an
integer value. I would appreciate any help you can give to me as i would
still use convolutional codes and concatenated codes.
Hope to hear from you soon.
Tito

% Reed-Solomon Codes with awgn
m = 4; % Number of bits in each symbol
n = 2^m-1; k = 13; % Codeword length and message length
data = randint(4,k,2^m); % Four random integer messages
msg = gf(data,m); % Represent data using a Galois array.
% Encode the message
c1 = rsenc(msg,n,k);
code = double(c1.x);
% Main steps in the simulation
%% Channel
% Send signal over an AWGN channel.
%% Setup
% Define parameters.
M1 = 16; % Size of signal constellation
k1 = log2(M1); % Number of bits per symbol
n1 = 3e4; % Number of bits to process
nsamp = 1; % Oversampling rate
EbNo = 10; % In dB
% Note: Because No = 2*noiseVariance^2, we must add 3 dB
% to get SNR. For details, see Proakis book listed in
% "Selected Bibliography for Performance Evaluation."
snr = EbNo + 10*log10(k1) - 10*log10(nsamp);
ynoisy = awgn(real(code),snr,'measured');
%ynoisy = awgn(code,snr,'measured');% Add white Gaussian noise
msg2 = gf(ynoisy,m);
decoded = rsdec(msg2,n,k);
x = decoded;
decoded_x = decoded.x;
z = double(decoded_x);
% Compute bit error rate from simulation.
[num,rt] = biterr(data,z)

```
```tito12 <bolatito12@yahoo.com> wrote:

> Hello all, please i need urgent help I have used the inbuilt
> matlab functions as described in matlab for Reed Solomon and
> Convolutional codes. I have a binary file that i want to simulate
> using an awgn and a mobile channel. Ineed to calculate the ber
> and (EbNo) plot them on a graph. But the noisy signal i get
> after adding awgn to the code cannot be decoded by Reed Solomon
> decoder since it is not an integer value. I would appreciate

You need to use something that is traditionally called a "modem".

Hope this helps.

Steve
```
```On Thursday, August 13, 2009 1:19:31 AM UTC+3, tito12 wrote:
> Hello all, please i need urgent help
> I have used the inbuilt matlab functions as described in matlab for Reed
> Solomon and Convolutional codes. I have a binary file that i want to
> simulate using an awgn and a mobile channel. Ineed to calculate the ber and
> (EbNo) plot them on a graph. But the noisy signal i get after adding awgn
> to the code cannot be decoded by Reed Solomon decoder since it is not an
> integer value. I would appreciate any help you can give to me as i would
> still use convolutional codes and concatenated codes.
> Hope to hear from you soon.
> Tito
>
>
> % Reed-Solomon Codes with awgn
> m = 4; % Number of bits in each symbol
> n = 2^m-1; k = 13; % Codeword length and message length
> data = randint(4,k,2^m); % Four random integer messages
> msg = gf(data,m); % Represent data using a Galois array.
> % Encode the message
> c1 = rsenc(msg,n,k);
> code = double(c1.x);
> % Main steps in the simulation
> %% Channel
> % Send signal over an AWGN channel.
> %% Setup
> % Define parameters.
> M1 = 16; % Size of signal constellation
> k1 = log2(M1); % Number of bits per symbol
> n1 = 3e4; % Number of bits to process
> nsamp = 1; % Oversampling rate
> EbNo = 10; % In dB
> % Note: Because No = 2*noiseVariance^2, we must add 3 dB
> % to get SNR. For details, see Proakis book listed in
> % "Selected Bibliography for Performance Evaluation."
> snr = EbNo + 10*log10(k1) - 10*log10(nsamp);
> ynoisy = awgn(real(code),snr,'measured');
> %ynoisy = awgn(code,snr,'measured');% Add white Gaussian noise
> msg2 = gf(ynoisy,m);
> decoded = rsdec(msg2,n,k);
> x = decoded;
> decoded_x = decoded.x;
> z = double(decoded_x);
> % Compute bit error rate from simulation.
> [num,rt] = biterr(data,z)

```