70 lines
1.2 KiB
Matlab
70 lines
1.2 KiB
Matlab
function [Achirp,AchirpOut,H,scale] = fracF_init(a)
|
|
%#codegen
|
|
%
|
|
% fracF_init
|
|
%
|
|
% Precompute FrFT coefficients for DPW processing.
|
|
%
|
|
% INPUT:
|
|
% a - FrFT order (single)
|
|
%
|
|
% OUTPUTS:
|
|
% Achirp [1024 x 1]
|
|
% AchirpOut [512 x 1]
|
|
% H [2048 x 1]
|
|
% scale scalar
|
|
|
|
N = 1024;
|
|
|
|
pi_s = single(pi);
|
|
|
|
phi = a * (pi_s/2);
|
|
|
|
tan_half_phi = tan(phi/2);
|
|
sin_phi = sin(phi);
|
|
cos_phi = cos(phi);
|
|
|
|
csc_phi = 1/sin_phi;
|
|
cot_phi = cos_phi/sin_phi;
|
|
|
|
twoDelta = 2*sqrt(single(N)/2);
|
|
|
|
%% Chirp A
|
|
|
|
n = single((-N/2:N/2-1).') / twoDelta;
|
|
|
|
Achirp = exp(-1j*pi_s*(n.^2)*tan_half_phi);
|
|
|
|
%% Chirp B
|
|
|
|
m = single((-N:N-1).') / twoDelta;
|
|
|
|
Bchirp = exp(1j*pi_s*csc_phi*(m.^2));
|
|
|
|
%% FFT of Chirp B
|
|
|
|
H = fft(Bchirp);
|
|
|
|
%% Output chirp
|
|
|
|
AchirpOut = Achirp(1:2:end);
|
|
|
|
%% Scale factor
|
|
|
|
scale = sqrt(1 - 1j*cot_phi) / twoDelta;
|
|
|
|
%% Force single precision complex
|
|
|
|
Achirp = complex(single(real(Achirp)), ...
|
|
single(imag(Achirp)));
|
|
|
|
AchirpOut = complex(single(real(AchirpOut)), ...
|
|
single(imag(AchirpOut)));
|
|
|
|
H = complex(single(real(H)), ...
|
|
single(imag(H)));
|
|
|
|
scale = complex(single(real(scale)), ...
|
|
single(imag(scale)));
|
|
|
|
end |