69 lines
1.3 KiB
Matlab
69 lines
1.3 KiB
Matlab
%% 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 |