50 lines
1.8 KiB
Matlab
50 lines
1.8 KiB
Matlab
bandwidth_values = [20 40 80 160 320];
|
|
mcs_task4 = 3;
|
|
|
|
results = zeros(numel(bandwidth_values), numel(snrs));
|
|
chanBWs = strings(1, numel(bandwidth_values));
|
|
|
|
progressTitle = "Task 4.2";
|
|
progressStartText = "Starting bandwidth sweep";
|
|
f = waitbar(0, progressStartText, "Name", progressTitle);
|
|
progressTotal = numel(bandwidth_values) * numel(snrs);
|
|
progressQueue = parallel.pool.DataQueue;
|
|
|
|
parfor_waitbar(f, progressTotal, progressStartText, true);
|
|
progressListener = afterEach(progressQueue, @(info) parfor_waitbar(f, progressTotal, info, false));
|
|
|
|
for bandwidth_idx = 1 : numel(bandwidth_values)
|
|
currentBandwidth = bandwidth_values(bandwidth_idx);
|
|
[cfgEHT, simParameters, channel, chInfo, maxChDelay, satelliteDopplerShift, chanBW] = create_baseline_configuration(ntn_tdl_delay_profiles(3), currentBandwidth, false, "None", carrier_frequency, 0, 0, leo_altitude, random_stream, seed, tx_antenna_count, rx_antenna_count, apep);
|
|
|
|
cfgEHT.User{1}.MCS = mcs_task4;
|
|
chanBWs(bandwidth_idx) = string(chanBW);
|
|
|
|
parfor snr_idx = 1 : length(snrs)
|
|
local_channel = clone(channel);
|
|
[errorCount, packetCount, cfrMagnitudes] = simulateTransmission(cfgEHT, local_channel, maxChDelay, snrs(snr_idx), packets_per_snr, maxNumErrors, simParameters, chanBW, snr_idx, elevationAngles);
|
|
results(bandwidth_idx, snr_idx) = errorCount / packetCount;
|
|
send(progressQueue, sprintf("%s | SNR %.1f dB", chanBW, snrs(snr_idx)));
|
|
end
|
|
end
|
|
|
|
delete(progressListener);
|
|
if ishandle(f)
|
|
close(f);
|
|
end
|
|
|
|
markers = 'ox*sd^v><ph+ox*sd^v><ph+';
|
|
|
|
figure;
|
|
for bandwidth_idx = 1 : numel(bandwidth_values)
|
|
semilogy(snrs, results(bandwidth_idx, :), ['-' markers(bandwidth_idx)]);
|
|
hold on;
|
|
end
|
|
|
|
grid on;
|
|
xlabel('SNR (dB)');
|
|
ylabel('PER');
|
|
|
|
legend(chanBWs, 'Location', 'NorthEastOutside');
|
|
title(['PER over SNR for bandwidth sweep, NTN-TDL-C, MCS ' num2str(mcs_task4)]);
|