It is my understanding that you want to calculate the SNR in sets of 10 samples and receive the output after processing each batch for phase data stored in an Excel file with 36,001 samples.
You can do this by following the below steps:
1. Load the excel file using “xlsread” and extract the phase values (assuming they are in the first column).
data = xlsread('phase_data.xlsx'); % Load the file
phase_signal = data(:,1); % Extract phase values
2. Define batch size as 10 to process data in segments of 10 samples and initialize an empty array to store these SNR values.
num_samples = length(phase_signal);
window_size = 10; % Process every 10 samples
snr_values = []; % Store SNR values for each window
3. Process data in segments of 10.
for i = 1:window_size:num_samples-window_size+1
signal_chunk = phase_signal(i:i+window_size-1); % Extract 10 samples
4. Depending on your requirement, define the noise and signal conditions.
5. Compute SNR in dB.
SNR_dB = 10 * log10(signal_power / noise_power);
6. Store results
snr_values = [snr_values; SNR_dB];
% Display output after every 10 samples
fprintf('SNR for samples %d to %d: %.2f dB\n', i, i+window_size-1, SNR_dB);
end % end for loop
For reference, here is the link for the documentation on “xlsread”: