直接上程序——这是网上的后期发我写的
close all
clear all
%P0 = 0.5;
%P1 = 0.5;
%fs = N/Tb
N = 10;
L = 1000;
k0 = 2;
Th1 = 0;
A = 1;
rand('state',sum(100*clock));
for db = -5:15,
r = 10^(db/10);
sigma = 0.5*A*sqrt(N)/10^(db/20);
i0 = db+6;
Pe0PSK(i0) = 0.5*erfc(sqrt(r));
Pe0ASKa(i0) = 0.5*erfc(sqrt(r/2));
Pe0ASKb(i0) = 0.5*erfc(sqrt(r/4));
Pe0FSK(i0) = Pe0ASKa(i0);
Th = 0.5*0.5*A^2*N;%2ASK
count = 0;
for j=1:L;
for i=1:N,
NN(i) = sigma*randn(1,1); %N(m, sigma)
s0(i) = 0;
s1(i) = A*sin(2*pi*k0*i/N);
x0(i) = s0(i) + NN(i);
x1(i) = s1(i) + NN(i);
end
summ0 = 0;
for i=1:N,
summ0 = summ0 + x0(i)*s1(i);
end
summa = su