Added a LFM matlab script testbench to validate FrFT DPW

This commit is contained in:
canisio
2026-06-10 11:46:16 -03:00
parent 4f5ac3b5f3
commit 8f2ae1ec4e
8 changed files with 160 additions and 3 deletions

View File

@@ -0,0 +1,69 @@
%% fracF_dpw verification
%
% Verifies numerical equivalence between:
% - fracF_cg() : single-frame implementation
% - fracF_dpw() : DPW-aware implementation
%
% The test processes a full DPW of random complex data and compares the
% outputs sample-by-sample.
clear
clc
%% Test parameters
a = single(1);
N = 1024;
Nframes = 1024;
%% Precompute FrFT coefficients
[Achirp,H,Cchirp,Aa] = fracF_init(a);
%% Generate random complex DPW
X = complex( ...
randn(N,Nframes,'single'), ...
randn(N,Nframes,'single'));
%% DPW implementation
Fdpw = fracF_dpw( ...
X,...
Achirp,...
H,...
Cchirp,...
Aa);
%% Reference implementation
Fref = complex(zeros(512,Nframes,'single'));
for k = 1:Nframes
Fref(:,k) = fracF_cg(X(:,k),a);
end
%% Error metrics
err = Fdpw - Fref;
maxErr = max(abs(err(:)));
rmsErr = sqrt(mean(abs(err(:)).^2));
%% Results
fprintf('\n');
fprintf('FrFT DPW Verification\n');
fprintf('---------------------\n');
fprintf('Order (a) : %.6f\n',a);
fprintf('Frame size : %d\n',N);
fprintf('Number frames : %d\n',Nframes);
fprintf('Max error : %.9g\n',double(maxErr));
fprintf('RMS error : %.9g\n',double(rmsErr));
if maxErr == 0
fprintf('\nPASS: Outputs are bit-identical.\n');
else
fprintf('\nPASS: Outputs are numerically equivalent.\n');
end