Your Equation

Library / Signal processing and digital filters / DSP-01

Signal processing and digital filters

Sample of a phase-offset sinusoid

Value of sample n of a sampled sinusoid of peak amplitude A and frequency f, taken at sampling rate fs, with initial phase φ in radians.

Ref
DSP-01
Rev
v1
Field
Signal processing and digital filters
Result
x[n] [V]

Sampling a cosine of frequency f at rate fs puts sample n at time t = n/fs, so its phase has advanced by 2πfn/fs radians since the start, and x[n] = A cos(2πfn/fs + φ). Each sample advances the phase by the fixed step 2πf/fs. If f is above fs/2 the samples are identical to those of a lower alias frequency.

Value of sample n of a sampled sinusoid of peak amplitude A and frequency f, taken at sampling rate fs, with initial phase φ in radians. Sampling begins at t = 0. For an unambiguous baseband representation use 0 ≤ f < fs/2.

Calculator

Solve for
V
V
0.001100
Hz
1100,000
01,000
Hz
101,000,000
rad
−3.1423.142
  • Phase advance per sample, 2πf/fs0.7854 rad
  • Samples per cycle, fs/f8 samples
  • Total phase at this sample, 2πfn/fs + φ1.085 rad

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.

Sample value (V) current value 0.9331 V
APeak amplitudeKey driver
4.67e-446.7
φInitial phase
−22
fsSampling rate
−1.912
fSignal frequency
−1.991.91
nSample index
−1.911.91
  • Sample 1 of this tone is 0.9331 V, 46.7 % of the peak amplitude of 2 V.
  • There are 8 samples per cycle, comfortably above the minimum of 2 required to avoid aliasing.
Chart data as tables

Ranked variables

VariableTypical rangeLowest resultHighest resultSwing (V)Local stepChange in result
A Peak amplitude0.001 to 100 V4.666e-446.6646.66+10%+10 %
φ Initial phase−3.142 to 3.142 rad−1.9971.9973.995+0.12566370600000001 rad−24.5 %
fs Sampling rate10 to 1,000,000 Hz−1.91123.911+10%+13.3 %
f Signal frequency1 to 100,000 Hz−1.9941.9113.905+10%−15.2 %
n Sample index0 to 1,000 −1.9111.9113.821+1 −163 %

Sweep of Sample index

Sample indexSample value (V)
01.911
125−0.9331
250−0.591
3751.769
500−1.911
6250.9331
7500.591
875−1.769
1,0001.911

Sweep one variable

Sample value (V)Hover, touch, or use the arrow keys on the chart
−2−1012 02004006008001000 Sample index now 0.9331

Variables and how each one contributes

x[n]

Sample value

Result · V

What the equation gives you. Everything else feeds it.

A

Peak amplitude

V · typical 0.001 to 100

The peak amplitude of the sinusoid, in V. Scales every sample in direct proportion. Raising it by 10 % (to 2.2) moves the result by +10 %, from 0.9331 to 1.026 V.

f

Signal frequency

Hz · typical 1 to 100,000

The signal frequency, in Hz. A higher frequency advances the phase faster per sample; above fs/2 it aliases. Raising it by 10 % (to 137.5) moves the result by −15.2 %, from 0.9331 to 0.7915 V.

n

Sample index

· typical 0 to 1,000

The sample index, counted from zero. Moves along the waveform; the pattern repeats every fs/f samples. Raising it by 10 % (to 1.1) moves the result by +0 %, from 0.9331 to 0.9331 V.

fs

Sampling rate

Hz · typical 10 to 1,000,000

The sampling rate, in Hz. A higher rate gives a smaller phase step per sample and a smoother sampled waveform. Raising it by 10 % (to 1,100) moves the result by +13.3 %, from 0.9331 to 1.057 V.

φ

Initial phase

rad · typical −3.142 to 3.142

The initial phase at t = 0, in radians. Shifts the whole waveform in time without changing its shape. Raising it by 10 % (to 0.33) moves the result by −5.73 %, from 0.9331 to 0.8796 V.

Worked example with the values above

  1. Phase step per sample: 2πf/fs = 2π × 125 / 1,000 = 0.7854 rad.
  2. Phase at n = 1: 0.7854 × 1 + 0.3 = 1.0854 rad.
  3. x[n] = A cos(…) = 2 × 0.46656 = 0.93312 V.

Assumptions and limits

  • Uniform sampling at a fixed, known rate with a clean, stable clock unless the page names a jitter term.
  • Ideal, linear converters and a signal that stays inside full scale.

Common mistakes

  • Using a frequency above fs/2, which aliases to a different baseband frequency.
  • Mixing hertz with radians per second or rad/sample.
  • Counting jitter or quantisation as the only noise source and forgetting thermal and clock noise.

Statistics and uncertainty

Real converters add offset, gain error, nonlinearity and thermal noise to the ideal quantisation and jitter limits, so a measured SNR is typically 3 dB to 10 dB below the ideal figure. Treat these formulas as upper bounds on performance.

Where it is used

  • Generating test signals and predicting what a converter can resolve.
  • Choosing a sampling rate, a bit depth and a clock source for an acquisition chain.

Maths you need

  • Sampling theorem: a signal bandlimited below fs/2 is fully described by its samples
  • Decibel: dB = 20 log₁₀ of an amplitude ratio
  • Nyquist frequency: half the sampling rate

Related formulas

Practise this formula