16qam matlab 误码率,16QAM理论误码率与实际误码率MATLAB仿真程序

%%16QAM

%%等效基带调制

clc;

clear all;

close all;%%关闭所有窗口,比如之前画的图

nsymbol = 10000;%%每种信噪比下符号数的发送符号数,10^6个数errornumber = zeros(1,10);

errorratio = zeros(1,10);

data = randi([0,1],1,4*nsymbol);%%产生1行,4*nsymbol列均匀分布的随机数data_mod1 = zeros(1,nsymbol);%%各参量初始化

data_mod2 = zeros(1,nsymbol);

data_demod1 = zeros(1,nsymbol);

data_demod2 = zeros(1,nsymbol);

data_demod3 = zeros(1,nsymbol);

data_demod4 = zeros(1,nsymbol);

s_receive1 = zeros(1,nsymbol);

s_receive2 = zeros(1,nsymbol);

for i = 1:nsymbol %%格雷码调制到星座图的映射

if data(4*i-3)==0 && data(4*i-2)==0

data_mod1(i) = 3;

if data(4*i-1)==0 && data(4*i)==0

data_mod2(i) = 3;

elseif data(4*i-1)==0 && data(4*i)==1

data_mod2(i) = 1;

elseif data(4*i-1)==1 && data(4*i)==1

data_mod2(i) = -1;

elseif data(4*i-1)==1 && data(4*i)==0

data_mod2(i) = -3;

end

elseif data(4*i-3)==0 && data(4*i-2)==1

data_mod1(i) = 1;

if data(4*i-1)==0 && data(4*i)==0

data_mod2(i) = 3;

elseif data(4*i-1)==0 && data(4*i)==1

data_mod2(i) = 1;

elseif data(4*i-1)==1 && data(4*i)==1

data_mod2(i) = -1;

elseif data(4*i-1)==1 && data(4*i)==0

data_mod2(i) = -3;

end

elseif data(4*i-3)==1 && data(4*i-2)==1

data_mod1(i) = -1;

你可能感兴趣的:(16qam,matlab,误码率)