new plots for Diss. Mostly AI gen. Few changes in actual codebase
This commit is contained in:
@@ -29,15 +29,21 @@ function [snr_all, snr_per_level] = calc_snr(tx_signal, eq_noise)
|
||||
|
||||
% Get the unique amplitude levels in the transmitted signal
|
||||
levels = unique(tx_signal);
|
||||
|
||||
% Preallocate an array to store the SNR for each unique level
|
||||
% Loop over each unique level to compute the SNR for that level
|
||||
for i = 1:length(levels)
|
||||
% Find indices where tx_signal equals the current level
|
||||
idx = (tx_signal == levels(i));
|
||||
|
||||
% Compute the SNR for these indices
|
||||
snr_per_level(i) = snr(tx_signal(idx), eq_noise(idx));
|
||||
|
||||
snr_per_level = zeros(numel(levels),1);
|
||||
|
||||
try
|
||||
% Preallocate an array to store the SNR for each unique level
|
||||
% Loop over each unique level to compute the SNR for that level
|
||||
for i = 1:length(levels)
|
||||
% Find indices where tx_signal equals the current level
|
||||
idx = (tx_signal == levels(i));
|
||||
|
||||
% Compute the SNR for these indices
|
||||
snr_per_level(i) = snr(tx_signal(idx), eq_noise(idx));
|
||||
|
||||
end
|
||||
catch ME
|
||||
% Handle any errors that occur during SNR calculation
|
||||
% warning('Error calculating SNR for level %d: %s', levels(i), ME.message);
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user