function [frq,A,phi,X] = fape(target,support)
%function [frq,A,phi,X] = fape(target,support)
%
% FAPE -- The "Frequency, Amplitude, and Phase Estimator"
%
% Input Parameters:
%   target  -- the target sinusoid whose frequency, amplitude, phase are unknown
%   support -- the support vector for the above sinusoid
%
% Output Parameters:
%   frq     -- the estimated frequency of the target sinusoid in radians per second
%   A       -- the estimated amplitude of the target sinusoid
%   phi     -- the estimated phase of the target sinusoid
%   X       -- the calculated vector of correlations


% Make both "target" and "support" column vectors
target = target(:);
support = support(:);

% Initialize X to all zeros
X = zeros(floor(length(target)/2),1);

% Determine the correlation length, N
N = length(target);

% Use "support" to determine the sampling period, T_s
T_s = ?


% Loop over values of k to calculate X(k)
for k = 1:N/2
    
    % Use "support" to generate a reference complex exponential with
    %   radian frequency of 2*pi*k/N/T_s radians per second
    ref = ?
    
    % Calculate the length-normalized correlation, X(k)
    %   (Hint: remember the complex conjugation!)
    X(k) = ?
end


% Find the largest correlation in X, max_val, and its index, k_max
?

% Use "k_max" to estimate the target sinusoid's frequency
frq = ?

% Use max_val to estimate the amplitude and phase
A = ?
phi = ?
