close all
Fd=1%消息序列的采样速率
Fs=3*Fd%以调信号的采样速率
M=4%4比特调制,qpsk
SNR=0:12%去信噪比从0到12
SNR1=0:0.1:12%步进为0.1
for n=1:length(SNR)%对每一snr计算一次
Eb_N0=10^(SNR(n)/10)%换算10进制
sgma=sqrt(1/(4*Eb_N0))%噪声信号的平方差开根号
x=randint(10000,1,M)%产生10000个输入符号
y=dmodce(x,Fd,Fs,'psk',M)%调制
ynoise=y+sqrt(Fs/Fd)*sgma*(randn(length(y),1)+1i*randn(length(y),1))%经过信道加噪声
z=ddemodce(ynoise,Fd,Fs,'psk',M)%解调
[numbers,pm(n)]=symerr(x,z)&求误符号率
end
for m=1:length(SNR1)%此循环用于画出理想的误符号率曲线
Eb_N0=10^(SNR1(m)/10)
pm1(m)=erfc(sqrt(log2(M)*Eb_N0)*sin(pi/M))
end
semilogy(SNR,pm,'-*',SNR1,pm1)%纵坐标取对数
xlabel('信噪比SNR/db')
ylabel('误码率(pe)')
legend('仿真误码率曲线','理论误码率曲线')
psk,fsk,ask matlab 程序不懂求助 m'西西沃 人气 1 回答 0 提问时间 2008-01-17 14:47 PSK系统程序: clear allM=4Fd=1Fs=32SNRperBit=5adjSNR=SNRperBit-10*log10(Fs/Fd)+10*log10(log2(M))%原始信号 x=randint(5000,1,M)tone=0.5randn('state',1945724)w1=dmodce(x,Fd,Fs,'psk',M,tone)y1=awgn(w1,adjSNR,'measured',[],'dB')z1=ddemodce(y1,Fd,Fs,'psk',M,tone)PSKser=symerr(x,z1)运行结果显示: FSK系统程序: clear allM=4Fd=1Fs=32SNRperBit=5adjSNR=SNRperBit-10*log10(Fs/Fd)+10*log10(log2(M))%原始信号 x=randint(5000,1,M)tone=0.5randn('state',1945724)w1=dmodce(x,Fd,Fs,'fsk',M,tone)y1=awgn(w1,adjSNR,'measured',[],'dB')z1=ddemodce(y1,Fd,Fs,'fsk',M,tone)FSKser=symerr(x,z1)运行结果显示: ASK系统程序: clear allM=4Fd=1Fs=32SNRperBit=5adjSNR=SNRperBit-10*log10(Fs/Fd)+10*log10(log2(M))%原始信号 x=randint(5000,1,M)tone=0.5randn('state',1945724)w1=dmodce(x,Fd,Fs,'qask',M,tone)y1=awgn(w1,adjSNR,'measured',[],'dB')z1=ddemodce(y1,Fd,Fs,'qask',M,tone)ASKser=symerr(x,z1)运行结果显示:欢迎分享,转载请注明来源:内存溢出
评论列表(0条)