validate sine over bypass using a post processing script in the logged data. Added folter post_processing and script checkTimeSamples
This commit is contained in:
83
utilities/post_processing/checkTimeSamples.m
Normal file
83
utilities/post_processing/checkTimeSamples.m
Normal file
@@ -0,0 +1,83 @@
|
||||
%% =========================================================
|
||||
% Data
|
||||
% =========================================================
|
||||
X = single(complex_out.Data);
|
||||
|
||||
%% =========================================================
|
||||
% Parameters
|
||||
% =========================================================
|
||||
Fs = 512e6; % Sampling rate (Hz)
|
||||
N = 512; % Frame size
|
||||
|
||||
% Your data variable (rename if needed)
|
||||
% Expected size: [512 x 4 x 8]
|
||||
% X(frameSamples, frameIndex, timeIndex)
|
||||
% Example: X = your_workspace_variable;
|
||||
|
||||
[nSamples, nFrames, nTime] = size(X);
|
||||
|
||||
%% =========================================================
|
||||
% FFT Computation
|
||||
% =========================================================
|
||||
FFT_all = zeros(N, nFrames*nTime);
|
||||
|
||||
idx = 1;
|
||||
|
||||
for t = 1:nTime
|
||||
for f = 1:nFrames
|
||||
|
||||
x = X(:, f, t);
|
||||
|
||||
% Optional window (uncomment if needed)
|
||||
% w = hann(N);
|
||||
% x = x .* w;
|
||||
|
||||
Xf = fftshift(fft(x));
|
||||
FFT_all(:, idx) = abs(Xf);
|
||||
|
||||
idx = idx + 1;
|
||||
end
|
||||
end
|
||||
|
||||
%% =========================================================
|
||||
% Axes
|
||||
% =========================================================
|
||||
f_axis = (-N/2 : N/2-1) * (Fs/N) / 1e6; % MHz
|
||||
t_axis = 1:(nFrames*nTime); % frame index
|
||||
|
||||
%% =========================================================
|
||||
% Spectrogram-like view (BEST)
|
||||
% =========================================================
|
||||
figure;
|
||||
surf(t_axis, f_axis, 20*log10(FFT_all + 1e-12), 'EdgeColor', 'none');
|
||||
view(2);
|
||||
axis tight;
|
||||
|
||||
xlabel('Frame index');
|
||||
ylabel('Frequency (MHz)');
|
||||
title('FFT over time (per frame)');
|
||||
colorbar;
|
||||
|
||||
%% =========================================================
|
||||
% 3D Visualization (optional)
|
||||
% =========================================================
|
||||
figure;
|
||||
surf(t_axis, f_axis, FFT_all, 'EdgeColor', 'none');
|
||||
xlabel('Frame index');
|
||||
ylabel('Frequency (MHz)');
|
||||
zlabel('Magnitude');
|
||||
title('3D FFT evolution');
|
||||
|
||||
%% =========================================================
|
||||
% Single frame debug (optional)
|
||||
% =========================================================
|
||||
figure;
|
||||
x_dbg = X(:,1,1);
|
||||
Xf_dbg = fftshift(fft(x_dbg));
|
||||
|
||||
plot(f_axis, 20*log10(abs(Xf_dbg)+1e-12));
|
||||
grid on;
|
||||
|
||||
xlabel('Frequency (MHz)');
|
||||
ylabel('Magnitude (dB)');
|
||||
title('Single Frame FFT');
|
||||
Reference in New Issue
Block a user