
by Barry Van Veen
Sinusoids play an important role in describing physical phenomena. In some problems the amplitude and phase of data involving a sum of sinusoids is of interest. This post addresses the problem of estimating the amplitude and phase assuming the frequencies of the sinusoids are known. Estimation of the amplitude and phase of sinusoids is actually a much simpler problem than estimating the frequencies. The approach we take is based on formulating the problem in matrix-vector form. Matrix-vector formulations are extremely powerful tools in signal processing problems.
An often used approach to this problem is to take the discrete Fourier transform (DFT) of the data and identify the amplitude and phase from the DFT coefficients. This can work well if the sinusoids are of comparable power and well separated in frequency. It also can work well if the frequencies are harmonically related, especially if the data length is chosen to contain an integral number of periods of each sinusoid. In that case each sinusoid influences only one DFT coefficient. However, if the frequencies are spaced arbitrarily, the frequencies are close together, or the dynamic range is large, then the sidelobes associated with windowing cause interference between DFT coefficients.
Representing Sinusoids
The first step is to develop a "model" for the signal of interest. We begin by assuming that the data consists of a sum of cosines with varying amplitudes and phases
(1)
We assume the are known, and that the number of samples
is greater than twice the number of sinusoids, i.e.,
. It is convenient to use the identity for the cosine of a sum of angles to rewrite Eqn. (1) as a sum of a cosine and a sine term at each frequency
(2)
where and
. We will estimate
and
since
and
are easily obtained as
and
.
Next we rewrite Eqn. (2) in matrix-vector form. Collect all the data samples into an
-by-1 vector
We rewrite Eqn. (2) in vector form as
(3)
where we have defined an -by-1 cosine vector
and an
-by-1 sine vector
as
Next we collect the and
into a
-by-1 vector
and we collect the vectors and
into a
-by-
matrix
Finally, using the definitions of ,
, and
we may rewrite Eqn. (3) as the simple matrix-vector product
(4)
Note that the matrix is known since the frequencies are known. The unknown parameters of interest are confined to the vector
.
Estimation of the Amplitude and Phase of Sinusoids: A Matrix-Based Solution
The advantage of writing our model for the data as in Eqn. (4) is that it allows us to use simple matrix-vector manipulations to estimate from
. First we need a few observations.
is a rectangular matrix with at least as many rows (
) as columns (
). If the frequencies
are distinct and confined to the interval
, then it can be shown that the columns of
are linearly independent. In such a case the
-by-
matrix
is invertible. Note that superscript
denotes the transpose of a matrix - that is, interchanging the rows and columns. Proving linear independence and invertibility involves a bit of linear algebra, and is something we will not show here.
Armed with these facts, first multiply both sides of Eqn. (4) by to obtain
Now take the inverse of to obtain the estimate for
(5)
Once we spent the time to define the notation, the final answer is almost trivial to write down. This is the power of matrix-vector formulations of signal processing problems.
Equation (5) is an exact expression for in terms of
, which implies we can obtain the amplitudes
and phases
exactly. This relationship only holds for
, which places an upper bound on the number of sinusoids for a given data length. Note that if
, then we have more unknown quantities than we have data!
Perfect Estimation?
Equation (5) suggests we can perfectly recover the amplitude and phase of sinusoids having arbitrary frequency spacings. If this sounds too good to be true, it is. There are two effects that make perfect estimation impossible in practice: noise and errors in the assumed frequencies. Noise is always present - even if only due to quantization errors when the data is sampled. Noise introduces errors into the estimates. The size of the errors depends on the power of the noise, the number of sinusoids, and the frequency spacing. This topic will be addressed in detail in the next post. Obviously, if the assumed frequencies of the sinusoids are not equal to the true frequencies, we will also incur errors.
What About the DFT?
It turns out that a special case of the procedure presented here is equivalent to the DFT. That is, the DFT is equivalent to Eqn. (5) if and only if the frequencies are integral multiples of
. This fact is a slight extension of The Matrix Interpretation of the DFT lesson. If the
are not integral multiples of
, then the DFT matrix applied to
in Eqn. (4) does not recover
, but in general each DFT coefficient contains contributions from all the sinusoids. The mainlobe and sidelobes associated with each sinusoid interfere with the amplitude and phase of all the others. This can be viewed as an error due to a difference between the assumed (integer multiples of
) and true frequencies
. In the special case where the
are integral multiples of
, then all the sinusoids are located at zero crossings of the sinc functions associated with the other sinusoids, and the sinusoids do not interfere with one another in the DFT coefficients.
In contrast, the procedure described by Eqn. (5) applies to arbitrary sinusoid frequencies and only requires that be invertible. This condition is satisfied if the data length
exceeds twice the number of sinusoids
, and all the frequencies are distinct. Example 2 in the Maximum Likelihood Estimation Examples lesson shows how Eqn. (5) is related to the maximum likelihood estimate of
.