# help in finding modulation error rate

Status
Not open for further replies.

#### syed_brunel

##### Newbie level 6
modulation error rate

can any 1 tell me that how to find the modulation error ratio ,i mean i have a constellation before modulation and have a constellation after the modulation .so how can i express this in matlab.

finding the error rate

The following example available here computes both the theoratical and simulated modulation error rate of a 4-PAM modulation. I hope it will help you.

modulation error ratio min

this will help u

clear all;
N=10^4 %symbols
M=16; % for 16 qam
error=0;
count=1;
SNR1=[0:20];
a=SNR1/10;
SNR=10.^a;
% EbN0=20;
for i=1:length(SNR)
EbN0=SNR(i);

L=log2(M);% number of bits
bits=1000;
b=0;
while (a<bits)
b=1000*count;
count=count+1;
data=((sign(randn(N*L,1)+1))>0.5).'; % bit to send

tbl=[0;1];
for i=1L-1) tbl=[tbl zeros(length(tbl),1); flipud(tbl) ones(length(tbl),1)]; end;

tmp = sortrows([bi2de(tbl)'; [0 : M-1]]');
Reordering = tmp ,2)';

Vals = [0:M-1];

Y= fix(Vals./sqrt(M)); % y=0:3 => row
% % counting forward for odd rows, backward for even rows
x = -sign(mod(Y,2)-0.5).*(bitand(Vals,sqrt(M)-1)*2+1-sqrt(M)); % x = +/- (0:3)*2+1-4
y = sqrt(M)-Y*2-1; % y = 4 - y*2-1
constellation = x + j*y; % constellation points % construct result
% scatterplot(constellation);

constellationpower = sqrt(mean(abs(constellation).^2)); % calculate average power
modulationconstellation= constellation(Reordering+1)/constellationpower;

EsN0 = EbN0 * L;

% needed to perform bi2de conversion
bpwr = (2.^(0L-1)));
% scale looked up modulated constellation index obtained by bi2de conversion

if ((mod(size(data,2),L)~=0) & (1))
data = [data zeros(1,L-mod(size(data,2),L))];
end;

z = sqrt(EsN0) * modulationconstellation( bpwr*reshape(data,L,size(data,2)/L) + 1 );
% noise
noise=1/sqrt(2)*(randn(1,length(z))+j*randn(1,length(z)));
h=1;
y=h*z+noise;%modulation

% demodulation
% getting index of a minimum value
for k=1:length sig=y(k)*ones(M,1);
[m,index(k)]=min(sig-(h*sqrt(EsN0)*modulationconstellation.'));
end

% need to perform decimal to binary conversion

binary=(de2bi(index-1)).';
bitrcv=binary(; % bit recieved
end

modulation error rate),

dear joatt,

according to the diagram there should be atleast error in the answer of nErr(ii) bcz the theoreticak and simulated result deviate at last point ,anywaz thanks for helping me out ,but i need to know abt the modulation error rate,symbol error rate is not the modulation error rate (i guess).May be u can explain me better .

regards.
Syed

hye sundar,

i is showing me lots of error in parenthesis related issues in line 24,47 etc etc..
Can you help me out..

Status
Not open for further replies.