matlab 计算误码率,关于误码率的问题 急!!!!! -ag凯发k8国际
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
求助各位大佬
要求是2ask调制 通过滚降系数为0,0.5,1的升余弦滚降滤波器,信道加入1-15db的高斯白噪声,
相干解调,匹配滤波后计算出误码率与信噪比的关系图与理论值拟合。
现在问题是计算出的误码率过高无法拟合,请教各位大佬应该怎么修改。明天就要交论文了 曲线一直拟合不上
好急
%%---baseband signal parameters---%%
d_r = 32e3; �te rate = 32kbps
p_d = 1/d_r; %pulse duration
%signal generation
bits = 16;
rand_data = randi([0 1], 1,16);
input = repmat(rand_data',1,2000)';
input = input(:)';
t = linspace(0,bits,numel(input));
figure(1);
subplot(3,1,1);
plot(t,input);
title('input bit stream');
xlabel('samples');
ylabel('amplitude');
grid on
%�rrier generation
fc = 10;
carrier = cos(2 * pi * fc * t);
subplot(3,1,2);
plot(t,carrier);
title('carrier');
xlabel('samples');
ylabel('amplitude');
grid;
%%raised cosine rolloff filter
%%rolloff = 0
rolloff = 0;
span = 20;
sps = 50;
rcosfilter_1 = rcosdesign(rolloff, span, sps,'sqrt');
shapedsignal_1 = conv(input,rcosfilter_1,'same');
figure(2)
subplot(3,1,1);
plot(t,shapedsignal_1);
title('shaped signal rolloff = 0');
xlabel('samples');
ylabel('amplitude');
rolloff = 0.5;
span = 20;
sps = 50;
rcosfilter_2 = rcosdesign(rolloff, span, sps,'sqrt');
shapedsignal_2 = conv(input,rcosfilter_2,'same');
subplot(3,1,2);
plot(t,shapedsignal_2);
title('shaped signal rolloff = 0.5');
xlabel('samples');
ylabel('amplitude');
rolloff = 1;
span = 20;
sps = 50;
rcosfilter_3 = rcosdesign(rolloff, span, sps,'sqrt');
shapedsignal_3 = conv(input,rcosfilter_3,'same');
subplot(3,1,3);
plot(t,shapedsignal_3);
title('shaped signal rolloff = 1');
xlabel('samples');
ylabel('amplitude');
%%ask modulation
modulationsignal_1 = carrier .* shapedsignal_1;
figure(3);
subplot(3,1,1);
plot(t,modulationsignal_1);
title('modulation signal rolloff = 0');
xlabel('samples');
ylabel('amplitude');
grid on;
modulationsignal_2 = carrier .* shapedsignal_2;
subplot(3,1,2);
plot(t,modulationsignal_2);
title('modulation signal rolloff = 0.5');
xlabel('samples');
ylabel('amplitude');
grid on;
modulationsignal_3 = carrier .* shapedsignal_3;
subplot(3,1,3);
plot(t,modulationsignal_3);
title('modulation signal rolloff = 1');
xlabel('samples');
ylabel('amplitude');
grid on;
lpf = fdesign.lowpass('fp,fst,ap,ast',1,20,1,60,100);
lowpass = design(lpf,'equiripple');
%[ a b c d] = butter(10,[1 5]/50);
[b a] = butter(5,0.95,'low');
%d=designfilt('bandpassfir','filterorder',50, ...
%'cutofffrequency1',1,'cutofffrequency2',5, ...
%'samplerate',100);
%�d noise
h = 1;j = 1;
for snr = 1:1:15
snrlin = 10.^(snr./10);
rxsig_1=awgn(modulationsignal_3,snr,'measured',1);
%�modulation
x = rxsig_1.* carrier;
%e = filter(d,x);
y = filter(lowpass,x);
%e = envelope(y);
z = conv(y,rcosfilter_3,'same');
%e = envelope(z);
figure(4);
subplot(4,4,snr);
plot(t,rxsig_1,'g','linewidth',2);
hold on;
plot(t,modulationsignal_3,'b');
title(['snr:',num2str(snr),'db']);
xlabel('samples');
ylabel('amplitude');
%%comparator
l = length(y);
for i = 1:1:l
if z(i)> 2
output(i) = 1;
else
output(i) = 0;
end
end
figure(5);
xlabel('samples');
ylabel('amplitude');
subplot(5,3,snr);
plot(t,output);
title(['snr:',num2str(snr),'db'])
error = length(find(output ~= input));
cber(h) = error/32000;
h = h 1;
tber(j) = qfunc(sqrt(snrlin));
snrdb(j) = snr;
j = j 1;
end
figure(4);
legend('signal with noise','signal after filteration');
figure(5);
legend('received bits with different singal to noise radio');
figure('name','comparison b/w theoretical&calculated ber');
semilogy(snrdb,cber,'-bo',snrdb,tber,'-mh');
hold on;
grid on;
legend('ber calculated','ber theoretical')
xlabel('snr in db');
ylabel('bit error rate');
总结
以上是ag凯发k8国际为你收集整理的matlab 计算误码率,关于误码率的问题 急!!!!!的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇:
- 下一篇: