# Detecting a frequency swept sinusoid and its parameters?

Given a (FFT-sized) frame of data, and detection of a spectral component statistically above the noise floor in the FFT of this window, what characteristics or signal analysis could be used to determine that this spectral component is more likely to be a linearly swept sinusoid, rather than one that is stationary across the frame?

And, assuming the dF/dt sweep across the data window is small (from a fraction of an FFT bin to a couple bins), how can one estimate the sweep parameter (but, beyond answer offered to this question, assuming this is an estimation of a detected signal in noise.)

One offered solution seems to be to segment the FFT frame into several shorter subframes, do shorter STFTs, and look for a linear best fit among the resulting set of subframe FFT peak magnitude frequency estimates (which all have poorer frequency resolution due to the shorter subframes). Are there any other or better options for detection and estimation?

• Are you always assuming a linear sweep or there is no restriction on the sweep parameters? – learner Nov 3 '14 at 6:18
• I am looking for indications of whether a linearly swept sinusoid is a better estimate (least squares fit?) than a stationary sinusoid for a signal of unknown (sweep or other modulation) parameters, and if so, how to determine what linear sweep parameter might provide the closest estimate. – hotpaw2 Nov 3 '14 at 6:53

You could compute the instantaneous frequency of the signal in the frame. This can be done as outlined in this paper (e.g. Eq.(9)). You need to compute the analytic signal using a Hilbert transformer:

$$x_a[n]=x[n]+jx_h[n]\tag{1}$$

where $x_h[n]$ is the Hilbert transform of $x[n]$. The instantaneous frequency is given by the (discrete-time) derivative of the phase of (1). If you use a first order difference for approximating the discrete-time derivative you'll get the formula given in Eq. (9) of the paper cited above. Given an estimate of the instantaneous frequency, you could simply fit a line to estimate the sweep parameter.

This little Matlab/Octave script shows how this approach would work with a toy problem:

% create chirp signal
N = 256;
n=(0:N-1)';
fx=(0.1+0.01*n/N);
x=sin(2*pi*fx.*n);

% compute analytic signal
xh=hilbert(x);
xr=real(xh);xi=imag(xh);

% compute instanteneous frequency (could be done over fewer points)
tmp1 = xr(1:N-1).*xi(2:N) - xr(2:N).*xi(1:N-1);
tmp2 = xr(1:N-1).*xr(2:N) + xi(1:N-1).*xi(2:N);
f=atan2(tmp1,tmp2)/(2*pi);  % (biased) estimate of instanteneous frequency

% linear regression over center values of f
skip = floor(N/4);    % skip unreliable points at beginning and end of f
na = skip:(N-skip);
A=[ones(length(na),1),na(:)];
u=A\f(na);

f0=u(1); k=u(2)/2;  % remove bias
[f0,k]

% reconstructed linear frequency
fr = f0 + k*n;

plot(n,fx,(2:N),f-k*(2:N)',n,fr,':')
legend('exact','estimated','reconstructed')
axis([0,N,f0*.9,(f0+k*N)*1.1])


The plot shows the actual linear frequency of the signal (blue), the estimate from the analytic signal (green), and the reconstructed frequency obtained from fitting a line through the estimated frequency. Note that the estimate is unreliable at both ends, so the line is fitted to the center values of the frequency estimate.

• This method of trying to find the instantaneous frequency (an ill defined concept for general signals) is usually not recommended since it is extremely sensitive to noise. Phase unwrapping in the presence of noise can be problematic. An alternative is to use an adaptive notch filter e.g. Nehorai "A minimal parameter adaptive notch filter with constrained poles and zeros" IEEE Trans. Acoustics, Speech and Signal Processing, 1985 pg 983 -996 – David Nov 4 '14 at 13:51
• @David: Note that this method does not involve any explicit phase unwrapping. – Matt L. Nov 4 '14 at 15:04