Qu

sinad_estimate

Builtin index · Signal processing

result = sinad_estimate(bits, crest_factor)

Input: bits, crest_factor · Output: result

What it is

bits: a number, the converter resolution; crest_factor: a number, the signal's peak-to-RMS ratio (e.g. sqrt(2) for a sine wave) — both required positional scalars, not a data record.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = sinad_estimate(bits, crest_factor)
bits numberbits: a number, the converter resolution.
crest_factor numbercrest_factor: a number, the signal's peak-to-RMS ratio (e.g.
result number
Returns a single number: sinad_estimate in dB, enob_estimate in bits. Closed-form estimate of the SINAD/ENOB an ideal bits-resolution converter would show for a signal of the given crest_factor, with no record needed — the theoretical curve the measured sinad(x)/enob(x) above are checked against.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

fs = 1000
n = 0:1:1023
t = n / fs
f0 = 99 * fs / 1024          # exactly 99 cycles in the record -- coherent sampling

clean = sin(2*pi*f0*t)
x = clean + 0.01 * sin(2*pi*3*f0*t) + 0.001 * randn(1024, seed=3)

r = sinad(x)     # full breakdown: r.sinad, r.enob, r.snr, r.thd, r.sfdr

print("THD  = {thd(x)} dB")
print("SNR  = {snr(x)} dB")
print("SINAD = {r.sinad} dB, ENOB = {r.enob} bits, SFDR = {sfdr(x)} dB")
print("ENOB (from thd/sinad breakdown) = {enob(x)} bits")

# closed-form estimates: what an ideal N-bit converter would show for a

# signal of a given crest factor, no record needed -- the number sinad(x)

# above is checked against. Signature is (bits, crest_factor).

est_sinad = sinad_estimate(12, sqrt(2))    # 12-bit ADC, sine-wave crest factor

est_enob  = enob_estimate(12, sqrt(2))
print("ideal 12-bit ADC: SINAD = {est_sinad} dB, ENOB = {est_enob} bits")
output
THD  = -39.98542 dB
SNR  = 56.858996 dB
SINAD = 39.897111 dB, ENOB = 6.335068 bits, SFDR = 39.986015 dB
ENOB (from thd/sinad breakdown) = 6.335068 bits
ideal 12-bit ADC: SINAD = 74 dB, ENOB = 12 bits

from signal-processing

How it works

sinad_estimate(bits, crest_factor) -- the SINAD an ideal converter of that resolution would show for a signal of that crest factor, without needing a record. SINAD ~= 6.02 N + 1.76 - 20 log10(CF / sqrt(2)) This is the estimate the measured sinad(...) exists to be checked against, and it is what makes crest factor a resolution problem: every doubling costs 6 dB, which is one bit.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.

See also

enob_estimate — documented in the same entry.