%function p = ss_Pe94(snr_in_dB,Lc,A,w0)
echo on
snr_in_dB=0:5:30;
Lc=20;
A=4;
w0=1;
snr=10^(snr_in_dB/10);
sgma=1;
Eb=2*sgma^2*snr;
E_chip=Eb/Lc;
num_of_err=0;
N=10000;
for i=1;N,
temp=rand;
if(temp<0.5),
data=-1;
else
data=1;
end;
%将其重复Lc次
for j=1:Lc,
repeated_data(j)=data;
end;
for j=1:Lc,
temp=rand;
if(temp<0.5),
pn_seq(j)=-1;
else
pn_seq(j)=1;
end;
end;
%发送信号为
trans_sig=sqrt(E_chip)*repeated_data.*pn_seq;
%方差为sgma^2的高斯白噪声
noise=sgma*randn(1,Lc);
%干扰
n=(i-1)*Lc+1:i*Lc;
interference=A*sin(w0*n);
%接收信号
rec_sig=trans_sig+noise+interference;
%从接收信号中产生判决变量
temp=rec_sig.*pn_seq;
decision_variable=sum(temp);
if(decision_variable<0),
decision=-1;
else
decision=1;
end;
if(decision~=data),
num_of_err=num_of_err+1;
end;
end;
p=num_of_err/N;
运行时出现 Empty state-space model.
是因为程序有问题吗 ?