📄 test_data_throughput.m
字号:
% Measure thoughput for DM1 packet type for different SNRs
tic
clear Throughput_Results1 Throughput_Results2; % Clear previous results
% Define model
Modelname='bluetooth_full_duplex';
% Turn on AWGN
set_param([Modelname '/System parameters'],'Channel_type','AWGN');
% Set devices to DM1 packet type
set_param([Modelname '/System parameters'],'Packet_type','DM1');
Simulation_time=100/1600; % 100 slots
EsNo_tests = 9:1:14; % Range of SNR
for EsNo_test=1:length(EsNo_tests) % For each SNR level...
EsNo=EsNo_tests(EsNo_test); % Set EbNo level in workspace
% Display SNR currently being simulated
disp(['Testing EsNo: ' num2str(EsNo_tests(EsNo_test)) '...'] );
% Run simulation
sim(Modelname, Simulation_time);
% Display results
disp('Throughput Results:');
disp(['Device 1: ' num2str(Throughput1)]);
disp(['Device 2: ' num2str(Throughput2)]);
disp(' ');
Throughput_Results1(EsNo_test)=Throughput1;
Throughput_Results2(EsNo_test)=Throughput2;
end
% Plot total results
plot(EsNo_tests,Throughput_Results1/1000,EsNo_tests,Throughput_Results2/1000);
title('Throughput Results');
xlabel('EsNo');
ylabel('Throughput (kbps)');
axis([EsNo_tests(1) EsNo_tests(end) 0 130]);
legend('Device 1','Device 2')
grid;
toc
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -