求解下面的matlab程序!
色度控制中心
清楚的
SNR _ DB = 0:1:12;
sum = 1000000;
data= randsrc(sum,2,[0 1]);
[a1,b1]=find(data(:,1)= = 0 & amp;数据(:,2)= = 0);
消息(a 1)=-1-1i;
[a2,b2]=find(data(:,1)= 0 & amp;数据(:,2)= = 1);
消息(a2)=-1+1i;
find(data(:,1)= = 1 & amp;数据(:,2)= = 0);
消息(a3)= 1-1i;
[a4,b4]=find(data(:,1)= = 1 & amp;数据(:,2)= = 1);
消息(a4)= 1+1i;
散点图(消息)
标题(“B点信号星座图”)
a = 1;
TB = 1;
Eb = A * A * Tb
p _ signal = Eb/Tb;
没有=Eb。/(10.^(snr_db/10));
P _ noise = P _ signal * NO
sigma = sqrt(P _ noise);
对于Eb_NO_id=1:长度(sigma)
noise 1 = sigma(Eb _ NO _ id)* randn(1,sum);
noise 2 = sigma(Eb _ NO _ id)* randn(1,sum);
接收=消息+noise 1+noise 2 * 1i;
% resum = 0;
% total = 0;
m 1 = find(angle(receive)& lt;=π/2 & amp;角度(接收)>0);
remessage(1,m 1)= 1+1i;
redata(m1,1)= 1;
redata(m1,2)= 1;
m2= find( angle(receive)>π/2 & amp;角度(接收)& lt= pi);
remessage(1,m2)=-1+1i;
redata(m2,1)= 0;
redata(m2,2)= 1;
m3=find( angle(receive)>pi & amp角度(接收)& lt=-π/2);
remessage(1,m3)=-1-1i;
redata(m3,1)= 0;
redata(m3,2)= 0;
m4=find( angle(receive)>-π/2 & amp;角度(接收)& lt=0);
remessage(1,M4)= 1-1i;
redata(m4,1)= 1;
redata(m4,2)= 0;
[resum,ratio1]=symerr(data,redata);
pbit(Eb _ NO _ id)= resum/(sum * 2);
[total,ratio2]=symerr(message,re message);
PE(Eb _ NO _ id)= total/sum;
结束
散点图(接收)
标题(“C点信号星座图”)
PE = 1-(1-1/2 * erfc(sqrt(10。^(SNR_DB/10)/2))).^2;
pbit = 1/2 * erfc(sqrt(10。^(snr_db/10)/2));
图(三)
半对数(SNR_DB,pe,':s ',SNR_DB,Pe,'-* ',SNR_DB,pbit,'-o ',SNR_DB,Pbit,':+')
图例(“QPSK模拟误差率”,“QPSK理论误差率”,“QPSK模拟误差率”,“QPSK理论误差率”)
Xlabel(“信噪比/dB”)
Ylabel(“概率p”)
网格打开