⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 run_me.asv

📁 通信系统仿真主要仿真各种调制方式
💻 ASV
字号:
%% Display Start message
disp('Running Fading Channel BER Simulation set')
disp('To produce smoother simulation curves, increase')
disp('maxNumErr inside Fading_Simulate.m to collect more')
disp('errors.')
%% Plot theoretical curves
SNRs = 0:25;
[h_fig, h_lines] = Fading_BER_Curves(SNRs);
%% Run Monte Carlo simulations
disp('By default, this script does not run the Monte Carlo simulations.')
disp('It simply loads results from a previous run.  If you are interested in')
disp('running the simulations, edit run_me.m and uncomment the following')
disp('line:  fBER = Fading_Simulate;')
tic
% Pre-allocate
fBER = zeros(6,length(SNRs));

%% To Load from Disk (NO SIMULATIONS ARE RUN)
% Comment out this section if you want to run simulations
% load fBER  % Loads simulation results from disk instead of running them
% hold on
% simLines = semilogy(SNRs, fBER,'*');

%% To RUN SIMULATIONS
% Uncomment this section to run the simulations

hold on
% Create place-holder plots
simLines = semilogy(SNRs, fBER,'*');
fBER = Fading_Simulate(SNRs, simLines);
toc
%% Plot simulation results
hold on
SNRs = 0:1:25;
simLines = semilogy(SNRs, fBER,'*-');

%% Add Legend
% Do MATLAB graphics magic to create concise legend
% See "Controling Legends" in MATLAB doc

% group lines together
simGrp = hggroup('DisplayName','Simulation');
theoGrp = hggroup('DisplayName','Theoretical');
set(simLines,'Parent',simGrp)
set(h_lines,'Parent',theoGrp)
set(get(get(simGrp,'Annotation'),'LegendInformation'),...
    'IconDisplayStyle','on'); % Include this hggroup in the legend
set(get(get(theoGrp,'Annotation'),'LegendInformation'),...
    'IconDisplayStyle','on'); % Include this hggroup in the legend
legend show

figure1 = h_fig;
% Create textbox
annotation(figure1,'textbox',[0.6046 0.6266 0.1248 0.04538],...
    'String',{'No Diversity'},...
    'EdgeColor','none',...
    'BackgroundColor',[1 1 1]);

% Create textbox
annotation(figure1,'textbox',[0.63 0.4612 0.07359 0.04538],...
    'String',{'L = 2'},...
    'EdgeColor','none',...
    'BackgroundColor',[1 1 1]);

% Create textbox
annotation(figure1,'textbox',[0.6018 0.3718 0.07359 0.04538],...
    'String',{'L = 3'},...
    'EdgeColor','none',...
    'BackgroundColor',[1 1 1]);

% Create textbox
annotation(figure1,'textbox',[0.321 0.2733 0.08804 0.04538],...
    'String',{'AWGN'},...
    'EdgeColor','none',...
    'BackgroundColor',[1 1 1]);

% Create textarrow
annotation(figure1,'textarrow',[0.2853 0.4502],[0.5005 0.5],...
    'TextEdgeColor','none',...
    'TextBackgroundColor',[1 1 1],...
    'String',{'L = 4'});

% Create textarrow
annotation(figure1,'textarrow',[0.2912 0.4502],[0.4445 0.4455],...
    'TextEdgeColor','none',...
    'TextBackgroundColor',[1 1 1],...
    'String',{'L = 6'});

% Create textarrow
annotation(figure1,'textarrow',[0.3091 0.4517],[0.3945 0.3955],...
    'TextEdgeColor','none',...
    'TextBackgroundColor',[1 1 1],...
    'String',{'L = 8'});

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -