Your Equation

Library / Signal processing and digital filters / DSP-17

Signal processing and digital filters

Tone phase from sine and cosine projections

Phase of a coherent tone at interior bin k in the form A cos(θn + φ), from the sine and cosine projections of the first N samples (up to 8 here), taken relative to sample zero.

Ref
DSP-17
Rev
v1
Field
Signal processing and digital filters
Result
φ [rad]

For a tone A cos(θn + φ) with θn = 2πkn/N, the sums Σx cos θn = (AN/2) cos φ and Σx sin θn = −(AN/2) sin φ for a coherent tone at an interior bin. So φ = atan2(−Σx sin θn, Σx cos θn), relative to sample zero, and the amplitude is 2√(sc² + ss²)/N. An absent tone has no meaningful phase.

Phase of a coherent tone at interior bin k in the form A cos(θn + φ), from the sine and cosine projections of the first N samples (up to 8 here), taken relative to sample zero. A tone that is absent (both sums zero) has no meaningful phase.

Calculator

Solve for
rad
samples
28
17
V
−1010
V
−1010
V
−1010
V
−1010
V
−1010
V
−1010
V
−1010
V
−1010
  • Cosine projection, Σ x cos θ2 V
  • Sine projection, Σ x sin θ−2 V
  • Tone amplitude, 2√(sc² + ss²)/N1.414 V

What drives the result

Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.

Tone phase (rad) current value 0.7854 rad
x0Sample 0Key driver
0.182.92
x1Sample 1
−1.351.39
x2Sample 2
0.182.92
x3Sample 3
−1.351.39
kBin index
−1.570.785
NRecord length
6.12e-171.96
x4Sample 4
x5Sample 5
x6Sample 6
x7Sample 7
  • The tone has a phase of 0.7854 rad (45°) relative to sample zero, and an amplitude of 1.414 V.
  • The phase is measured against the record start, so a delay of d samples changes it by −2πkd/N; compare two channels over the same record.
Chart data as tables

Ranked variables

VariableTypical rangeLowest resultHighest resultSwing (rad)Local stepChange in result
x0 Sample 0−10 to 10 V0.17992.9232.743+0.4 V−11.5 %
x1 Sample 1−10 to 10 V−1.3521.3912.743+0.4 V−14.1 %
x2 Sample 2−10 to 10 V0.17992.9232.743+0.4 V+14.1 %
x3 Sample 3−10 to 10 V−1.3521.3912.743+0.4 V+11.5 %
k Bin index1 to 7 −1.5710.78542.356+1 −300 %
N Record length2 to 8 samples6.123e-171.9631.963+1 samples+60 %
x4 Sample 4−10 to 10 V0.78540.78540+0.4 V0 %
x5 Sample 5−10 to 10 V0.78540.78540+0.4 V0 %
x6 Sample 6−10 to 10 V0.78540.78540+0.4 V0 %
x7 Sample 7−10 to 10 V0.78540.78540+0.4 V0 %

Sweep of Sample 1

Sample 1 (V)Tone phase (rad)
−101.391
−7.51.34
−51.249
−2.51.052
00.4636
2.5−0.6435
5−1.107
7.5−1.272
10−1.352

Sweep one variable

Tone phase (rad)Hover, touch, or use the arrow keys on the chart
−1.5−1−0.500.511.5 −10−50510 Sample 1 (V) now 0.7854

Variables and how each one contributes

φ

Tone phase

Result · rad

What the equation gives you. Everything else feeds it.

N

Record length

samples · typical 2 to 8

The number of samples, up to 8 here. Sets the angle step 2πk/N and the normalisation. Raising it by 10 % (to 4.4) moves the result by +0 %, from 0.7854 to 0.7854 rad.

k

Bin index

· typical 1 to 7

The bin index of the tone. Sets how many cycles the tone completes in the record. Raising it by 10 % (to 1.1) moves the result by +0 %, from 0.7854 to 0.7854 rad.

x0

Sample 0

V · typical −10 to 10

The sample at index 0, in V (ignored if 0 ≥ N). Adds to the cosine and sine projections with weights cos and sin of 2πk0/N. Raising it by 10 % (to 1.1) moves the result by −3.1 %, from 0.7854 to 0.761 rad.

x1

Sample 1

V · typical −10 to 10

The sample at index 1, in V (ignored if 1 ≥ N). Adds to the cosine and sine projections with weights cos and sin of 2πk1/N. Raising it by 10 % (to −1.1) moves the result by +3.1 %, from 0.7854 to 0.8098 rad.

x2

Sample 2

V · typical −10 to 10

The sample at index 2, in V (ignored if 2 ≥ N). Adds to the cosine and sine projections with weights cos and sin of 2πk2/N. Raising it by 10 % (to −1.1) moves the result by −3.1 %, from 0.7854 to 0.761 rad.

x3

Sample 3

V · typical −10 to 10

The sample at index 3, in V (ignored if 3 ≥ N). Adds to the cosine and sine projections with weights cos and sin of 2πk3/N. Raising it by 10 % (to 1.1) moves the result by +3.1 %, from 0.7854 to 0.8098 rad.

x4

Sample 4

V · typical −10 to 10

The sample at index 4, in V (ignored if 4 ≥ N). Adds to the cosine and sine projections with weights cos and sin of 2πk4/N. Raising it by 10 % (to 0) moves the result by +0 %, from 0.7854 to 0.7854 rad.

x5

Sample 5

V · typical −10 to 10

The sample at index 5, in V (ignored if 5 ≥ N). Adds to the cosine and sine projections with weights cos and sin of 2πk5/N. Raising it by 10 % (to 0) moves the result by +0 %, from 0.7854 to 0.7854 rad.

x6

Sample 6

V · typical −10 to 10

The sample at index 6, in V (ignored if 6 ≥ N). Adds to the cosine and sine projections with weights cos and sin of 2πk6/N. Raising it by 10 % (to 0) moves the result by +0 %, from 0.7854 to 0.7854 rad.

x7

Sample 7

V · typical −10 to 10

The sample at index 7, in V (ignored if 7 ≥ N). Adds to the cosine and sine projections with weights cos and sin of 2πk7/N. Raising it by 10 % (to 0) moves the result by +0 %, from 0.7854 to 0.7854 rad.

Worked example with the values above

  1. Cosine sum: Σ x cos θ = 2; sine sum: Σ x sin θ = −2.
  2. Ratio: −Σ x sin θ over Σ x cos θ = 2 / 2.
  3. φ = atan2(2, 2) = 0.7854 rad, or 45°.

Assumptions and limits

  • A stationary signal with a tone of constant amplitude and frequency, and a record that holds a whole number of cycles for the coherent formulas.
  • A single, well-isolated spectral peak for interpolation, and a bandwidth that is stated.

Common mistakes

  • Using these coherent formulas on a record with a non-integer number of cycles.
  • Adding noise or a DC offset into the harmonic sum.
  • Using a peak that is not the largest of its three neighbouring bins in the parabolic interpolation.

Statistics and uncertainty

Tone amplitude and phase from a single FFT line are accurate to a fraction of a per cent only for a coherent record; for a non-coherent tone, scalloping loss of up to 3.9 dB (rectangular window) or 1.4 dB (Hann) adds error unless it is corrected.

Where it is used

  • Measuring amplitude, phase and distortion of tones in an FFT record.
  • Refining a frequency estimate without a longer record.

Maths you need

  • Coherent sampling: a whole number of signal cycles in the record
  • Spectral peak: a local maximum in the spectrum
  • Parseval’s theorem: power in the time domain equals power in the frequency domain

Related formulas

Practise this formula