该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
求助各位大佬
要求是2ask调制 通过滚降系数为0,0.5,1的升余弦滚降滤波器,信道加入1-15db的高斯白噪声,
相干解调,匹配滤波后计算出误码率与信噪比的关系图与理论值拟合。
现在问题是计算出的误码率过高无法拟合,请教各位大佬应该怎么修改。明天就要交论文了 曲线一直拟合不上
好急
%%---baseband signal parameters---%%
D_R = 32e3; %Date 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
%%carrier 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);
%%add noise
h = 1;j = 1;
for SNR = 1:1:15
snrlin = 10.^(SNR./10);
RxSig_1=awgn(modulationsignal_3,SNR,'measured',1);
%%demodulation
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');