📄 dopplererrorberplotter.m
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This script plots data generated by GenDopplerErrorBerData. This
% script assumes the data saved by that function is already present in the workspace.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Perform plotting
figure;
% Plot AWGN values
%subplot(2,1,1);
%hold on
dopplerIndex = 1;
for doppler = dopplerRange(1):dopplerRange(3):dopplerRange(2)
gammaMaxSimulated = gammaRangeAwgn(2);
for gammaMaxSimulatedIndex = 1:gammaSamplesAwgn
if (ber(gammaMaxSimulatedIndex,dopplerIndex,2,1) == 0)
% That's the flag for data value that wasn't calculated. So, back up one
% Not the greatest programming style to mess with the counter value in the middle
% of the loop, but this gets the job done.
gammaMaxSimulatedIndex = gammaMaxSimulatedIndex - 1;
gammaMaxSimulated = gammaRangeAwgn(1) + (gammaMaxSimulatedIndex - 1)*gammaRangeAwgn(3);
break;
end
end
semilogy([gammaRangeAwgn(1):gammaRangeAwgn(3):gammaRangeAwgn(2)],ber(1:gammaSamplesAwgn,dopplerIndex,1,1),'b-',...
[gammaRangeAwgn(1):gammaRangeAwgn(3):gammaRangeAwgn(2)],ber(1:gammaSamplesAwgn,dopplerIndex,1,1),'bo',...
[gammaRangeAwgn(1):gammaRangeAwgn(3):gammaMaxSimulated],ber(1:gammaMaxSimulatedIndex,dopplerIndex,2,1),'k-.',...
[gammaRangeAwgn(1):gammaRangeAwgn(3):gammaMaxSimulated],ber(1:gammaMaxSimulatedIndex,dopplerIndex,2,1),'k+');
hold on;
dopplerIndex = dopplerIndex + 1;
end
%title(['BER vs Es/N0 In AWGN, No Fading. doppler error, from top to bottom = ',num2str(dopplerRange(2):-dopplerRange(3):dopplerRange(1)),' radians']);
title(['BER vs Es/N0 In AWGN, No Fading. With Frequency Error.']);
xlabel('Es/N0 (dB)');
ylabel('BER');
legend('','Theoretical','','Simulated',3);
hold off
% Plot Rayleigh values
%subplot(2,1,2);
%hold on
figure
dopplerIndex = 1;
for doppler = dopplerRange(1):dopplerRange(3):dopplerRange(2)
gammaMaxSimulated = gammaRangeRayleigh(2);
for gammaMaxSimulatedIndex = 1:gammaSamplesRayleigh
if (ber(gammaMaxSimulatedIndex,dopplerIndex,2,2) == 0)
% That's the flag for data value that wasn't calculated. So, back up one
% Not the greatest programming style to mess with the counter value in the middle
% of the loop, but this gets the job done.
gammaMaxSimulatedIndex = gammaMaxSimulatedIndex - 1;
gammaMaxSimulated = gammaRangeRayleigh(1) + (gammaMaxSimulatedIndex - 1)*gammaRangeRayleigh(3);
break;
end
end
semilogy([gammaRangeRayleigh(1):gammaRangeRayleigh(3):gammaRangeRayleigh(2)],ber(1:gammaSamplesRayleigh,dopplerIndex,1,2),'b-',...
[gammaRangeRayleigh(1):gammaRangeRayleigh(3):gammaRangeRayleigh(2)],ber(1:gammaSamplesRayleigh,dopplerIndex,1,2),'bo',...
[gammaRangeRayleigh(1):gammaRangeRayleigh(3):gammaMaxSimulated],ber(1:gammaMaxSimulatedIndex,dopplerIndex,2,2),'k-.',...
[gammaRangeRayleigh(1):gammaRangeRayleigh(3):gammaMaxSimulated],ber(1:gammaMaxSimulatedIndex,dopplerIndex,2,2),'k+');
hold on;
dopplerIndex = dopplerIndex + 1;
end
title(['BER vs Es/N0 In AWGN, With Rayleigh Fading. With Frequency Error']);
xlabel('Es/N0 (dB)');
ylabel('BER');
legend('','Theoretical','','Simulated',3);
hold off
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -