%2FSK调制在瑞利信道下,卷积码
clear all
SNR=-10:10;
N=30000; %消息比特个数
berjj=zeros(1,length(SNR));
L=7; %约束长度
trel=poly2trellis(L,[171 133]);
tblen=6*L;
SymbolRate=2000; %符号速率
nsamp=8; %每个符号的取样点数
fs=5000;
Fs=9600;
Ts=1/Fs;
Fd=960;
delay=[0,0.002,0.005];
power=[0,-1,-3];
h=rayleighchan(Ts,Fd,delay,power);
msg=randi([0,1],1,N); %输入信号
msgjj=convenc(msg,trel); %卷积编码
x1jj=fskmod(msgjj,2,SymbolRate,nsamp,fs);
for ii=1:length(SNR)
x2jj=filter(h,x1jj);
yjj=x2jj+awgn(x1jj,SNR(ii));
y1jj=fskdemod(yjj,2,SymbolRate,nsamp,fs);
youtjj=vitdec(y1jj,trel,tblen,'cont','hard'); %硬判决
[err,berjj(ii)]= biterr(youtjj(tblen+1:end), msg(1:end-tblen)); %误比特率
disp(berjj);
end
figure(1)
semilogy(SNR,berjj,'-ro') ;
% legend('高斯');
title('卷积码 2FSK 瑞利信道')
xlabel('信噪比(dB)')
ylabel('误比特率')