Files
WirelessNetworkingTechnologies/lab_4/task2.m
T

64 lines
2.3 KiB
Matlab

apep_values = [250 1000 4000 8000 12000];
% apep_values = [250 600 800 1000];
results = zeros(numel(apep_values), numel(snrs));
if exist('task2ProgressLabel', 'var')
taskLabel = task2ProgressLabel;
else
taskLabel = "Task 2";
end
progressTitle = taskLabel;
progressStartText = "Starting APEP sweep";
f = waitbar(0, progressStartText, "Name", progressTitle);
progressTotal = numel(apep_values) * numel(snrs);
progressQueue = parallel.pool.DataQueue;
parfor_waitbar(f, progressTotal, progressStartText, true);
progressListener = afterEach(progressQueue, @(info) parfor_waitbar(f, progressTotal, info, false));
for apep_idx = 1 : numel(apep_values)
currentApep = apep_values(apep_idx);
[cfgEHT, simParameters, channel, chInfo, maxChDelay, satelliteDopplerShift, chanBW] = ...
create_baseline_configuration(ntn_tdl_delay_profiles(3), bandwidth, false, "None", ...
carrier_frequency, 0, ...
0, leo_altitude, random_stream, ...
seed, tx_antenna_count, ...
rx_antenna_count, currentApep);
cfgEHT.User{1}.MCS = mcs_t1;
parfor snr_idx = 1 : length(snrs)
local_channel = clone(channel);
if use_pilot_tracking
[errorCount, packetCount, cfrMagnitudes] = simulateTransmission(cfgEHT, local_channel, maxChDelay, snrs(snr_idx), packets_per_snr, maxNumErrors, simParameters, chanBW, snr_idx, elevationAngles, true);
else
[errorCount, packetCount, cfrMagnitudes] = simulateTransmission(cfgEHT, local_channel, maxChDelay, snrs(snr_idx), packets_per_snr, maxNumErrors, simParameters, chanBW, snr_idx, elevationAngles);
end
results(apep_idx, snr_idx) = errorCount / packetCount;
send(progressQueue, sprintf("APEP %d | SNR %.1f dB", currentApep, snrs(snr_idx)));
end
end
delete(progressListener);
if ishandle(f)
close(f);
end
markers = 'ox*sd^v><ph+ox*sd^v><ph+';
figure;
for apep_idx = 1 : numel(apep_values)
semilogy(snrs, results(apep_idx, :), ['-' markers(apep_idx)]);
hold on;
end
grid on;
xlabel('SNR (dB)');
ylabel('PER');
dataStr = arrayfun(@(x)sprintf('APEP %d', x), apep_values, 'UniformOutput', false);
legend(dataStr, 'Location', 'NorthEastOutside');
title(['PER over SNR for APEP sweep, ' num2str(cfgEHT.ChannelBandwidth) ', NTN-TDL-C']);