Organized codegen for fracFdpw. Tested with random input in matlab script. OK
This commit is contained in:
@@ -1,51 +1,116 @@
|
||||
function F = fracF_dpw(f,...
|
||||
Achirp,...
|
||||
AchirpOut,...
|
||||
H,...
|
||||
scale)
|
||||
Cchirp,...
|
||||
Aa)
|
||||
%#codegen
|
||||
%% fracF_dpw Fractional Fourier Transform for an entire DPW
|
||||
%
|
||||
% fracF_dpw
|
||||
% F = fracF_dpw(f,Achirp,H,Cchirp,Aa)
|
||||
%
|
||||
% Matrix FrFT processing for an entire DPW.
|
||||
% Computes the Fractional Fourier Transform (FrFT) of all frames in a
|
||||
% Digital Processing Window (DPW) using a matrix-oriented implementation.
|
||||
%
|
||||
% INPUT:
|
||||
% f [1024 x Nframes] complex(single)
|
||||
% Achirp [1024 x 1]
|
||||
% AchirpOut [512 x 1]
|
||||
% H [2048 x 1]
|
||||
% scale scalar
|
||||
% The algorithm follows the same chirp-convolution-chirp formulation as
|
||||
% fracF_cg(), but processes all DPW frames simultaneously. Each column of
|
||||
% the input matrix is treated as an independent frame, following the same
|
||||
% "columns are channels" convention used by DSP System Toolbox blocks.
|
||||
%
|
||||
% OUTPUT:
|
||||
% F [512 x Nframes]
|
||||
% Processing chain:
|
||||
%
|
||||
% f
|
||||
% ↓
|
||||
% Achirp
|
||||
% ↓
|
||||
% Zero-pad
|
||||
% ↓
|
||||
% FFT
|
||||
% ↓
|
||||
% H
|
||||
% ↓
|
||||
% IFFT
|
||||
% ↓
|
||||
% Extract
|
||||
% ↓
|
||||
% Cchirp
|
||||
% ↓
|
||||
% Aa
|
||||
% ↓
|
||||
% F
|
||||
%
|
||||
% INPUTS
|
||||
% f [1024 x Nframes] complex(single)
|
||||
% Interpolated DPW. Each column corresponds to one frame.
|
||||
%
|
||||
% Achirp [1024 x 1] complex(single)
|
||||
% Pre-multiplication chirp (A chirp).
|
||||
%
|
||||
% H [2048 x 1] complex(single)
|
||||
% FFT of the convolution chirp (B chirp).
|
||||
%
|
||||
% Cchirp [512 x 1] complex(single)
|
||||
% Post-multiplication chirp (C chirp).
|
||||
%
|
||||
% Aa scalar complex(single)
|
||||
% FrFT amplitude factor (A_alpha).
|
||||
%
|
||||
% OUTPUT
|
||||
% F [512 x Nframes] complex(single)
|
||||
% FrFT result for all DPW frames.
|
||||
%
|
||||
% Notes
|
||||
% - Input length is fixed at N = 1024 samples.
|
||||
% - Output length is N/2 = 512 samples.
|
||||
% - All DPW frames are processed simultaneously.
|
||||
% - Numerically equivalent to applying fracF_cg() independently to
|
||||
% each column of the input matrix.
|
||||
% - Intended for code generation and RFSoC PS deployment.
|
||||
%
|
||||
% See also:
|
||||
% fracF_init
|
||||
% fracF_cg
|
||||
|
||||
%% Fixed transform dimensions
|
||||
|
||||
N = 1024;
|
||||
Nfft = 2048;
|
||||
|
||||
%% DPW dimensions
|
||||
|
||||
Nframes = size(f,2);
|
||||
|
||||
%% First chirp multiplication
|
||||
%% Pre-multiplication chirp (A chirp)
|
||||
|
||||
g = f .* Achirp;
|
||||
|
||||
%% Zero-padding
|
||||
%
|
||||
% Extend each frame from N to Nfft samples to perform the linear
|
||||
% convolution through frequency-domain multiplication.
|
||||
|
||||
g_pad = complex(zeros(Nfft,Nframes,'single'));
|
||||
|
||||
g_pad(1:N,:) = g;
|
||||
|
||||
%% FFT convolution
|
||||
%% Frequency-domain convolution
|
||||
%
|
||||
% Compute the convolution with the B chirp using the FFT method.
|
||||
|
||||
Gfft = fft(g_pad);
|
||||
|
||||
G = ifft(Gfft .* H);
|
||||
|
||||
%% Extract valid region and decimate
|
||||
%% Extract valid convolution region and decimate
|
||||
%
|
||||
% The Ozaktas formulation requires only the valid portion of the
|
||||
% convolution result, followed by a factor-of-two decimation.
|
||||
|
||||
G_valid = G(N+1:2:end,:);
|
||||
|
||||
%% Final chirp multiplication
|
||||
%% Post-multiplication chirp (C chirp)
|
||||
%
|
||||
% Apply the final chirp and amplitude factor to obtain the FrFT output.
|
||||
|
||||
F = scale .* G_valid .* AchirpOut;
|
||||
F = Aa .* G_valid .* Cchirp;
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user