function[fnormhat,t]=instfreq(x,t,L,trace);
%INSTFREQ Instantaneous frequency estimation.
%[FNORMHAT,T]=INSTFREQ(X,T,L,TRACE) computes the instantaneous
%frequency of the analytic signal X at time instant(s) T, using the
%trapezoidal integration rule.
%The result FNORMHAT lies between 0.0 and 0.5.
%
%X : Analytic signal to be analyzed.
%T : Time instants (default : 2:length(X)-1).
%L : If L=1, computes the (normalized) instantaneous frequency
% of the signal X defined as angle(X(T+1)*conj(X(T-1)) ;
% if L>1, computes a Maximum Likelihood estimation of the
% instantaneous frequency of the deterministic part of the signal
% blurried in a white gaussian noise.
% L must be an integer (default : 1).
%TRACE : if nonzero, the progression of the algorithm is shown
% (default : 0).
%FNORMHAT