Engee documentation

sfdr

Dynamic range, free from parasitic components.

Library

EngeeDSP

Syntax

Function call

  • r = sfdr(x) — returns a dynamic range free of spurious components (Spurious-Free Dynamic Range, SFDR) r in dB of a real sinusoidal signal x. Function sfdr calculates the power spectrum using a modified periodogram and a Kaiser window with . The average value is subtracted from x before calculating the power spectrum. The number of points used in calculating the discrete Fourier transform (DFT) is equal to the length of the signal x.

  • r = sfdr(x,fs) — returns the SFDR of the input signal x in the time domain at a given sampling rate fs. Meaning fs the default value is 1 Hz.

  • r = sfdr(x,fs,msd) — returns SFDR, taking into account only the parasitic components that are separated from the main (carrier) frequency by the minimum distance between the parasitic components. msd, specified in cycles/unit of time. The sampling rate is fs. If the carrier frequency is Fc, then all the parasitic components in the interval (Fc−msd,Fc+msd) they are ignored.

  • r = sfdr(sxx,f,"power") — returns the SFDR of the one-way power spectrum of a real-valued signal sxx. Argument f — a vector of frequencies corresponding to power estimates in sxx. The first element f must be equal to 0. The algorithm removes all the power, which decreases monotonously as it moves away from the constant component of the cell.

  • r = sfdr(sxx,f,msd,"power") — returns SFDR, taking into account only the parasitic components that are separated from the main (carrier) frequency by the minimum distance between the parasitic components. msd. If the carrier frequency is Fc, then all the parasitic components in the interval (Fc−msd,Fc+msd) they are ignored. If the function input is sfdr The power spectrum is supplied, indicating msd It can prevent high levels of side lobes from being identified as parasitic constituents.

  • r,spurpow,spurfreq = sfdr(___) — returns the power and frequency of the largest parasitic component.

  • sfdr(___, out=:plot) — plots the signal spectrum in the current graph window. Different colors are used to display the main component, the value of the constant component, and the rest of the spectrum. The SFDR is shaded and its value is displayed above the graph. The main harmonic and the largest parasitic component are also noted.

Arguments

Input arguments

# x is a real sinusoidal signal

+ vector string | column vector

Details

A real sinusoidal signal defined as a row vector or column vector. The average value is subtracted from x before obtaining the power spectrum for calculating SFDR.

Типы данных

Float64

# fs — sampling rate
1 (by default) | positive scalar

Details

The sampling frequency of the signal in cycles/unit of time, set as a positive scalar. If the unit of time is seconds, fs measured in Hz.

Типы данных

Float64

# msd — minimum distance between parasitic components

+ 0 (by default) | positive scalar

Details

The minimum number of discrete Fourier transform (DFT) bins that should be ignored when calculating SFDR, set as a positive scalar. This argument can be used to ignore parasitic components or side lobes that occur near the fundamental frequency. For example, if the carrier frequency is Fc, then all the parasitic components in the range (Fc−msd,Fc+msd) they are ignored.

Типы данных

Float64

# sxx — one-way power spectrum

+ vector-row or vector-column of positive numbers

Details

A one-way power spectrum for use in SFDR calculation, specified as a row vector or column vector.

The power spectrum should be expressed in linear units, not in decibels.

Типы данных

Float64

# f is the frequency vector

+ A row vector or column vector of non-negative numbers

Details

The vector of frequencies corresponding to the power estimates in sxx, specified as a row vector or column vector.

Output arguments

# r is a dynamic range free of parasitic components

+ the real scalar

Details

The dynamic range, free of spurious components, in dB, returned as a real scalar. The dynamic range free of parasitic components is the difference in dB between the power at the peak frequency and the power at the next highest frequency (parasitic component). If the input data is a time series, power estimates are obtained from a modified periodogram using a Hamming window. The length of the DFT used in the periodogram is equal to the length of the input signal x. If you want to use a different power spectrum as the basis for SFDR measurement, you can enter your power spectrum using the flag "power".

Типы данных

Float64

# spurpow — the power of the largest parasitic component

+ the real scalar

Details

The power of the largest parasitic component in dB, returned as a real scalar.

Типы данных

Float64

# spurfreq — frequency of the largest parasitic component

+ the real scalar

Details

The frequency of the largest parasitic component in Hz, returned as a real scalar. If the sampling frequency is not specified as an input argument, the function sfdr assumes a sampling rate 1 Hz.

Типы данных

Float64

Examples

SFDR sinusoids

Details

Define the SFDR for the tone 10 MHz with amplitude 1, sampled at the frequency 100 MHz. On the first harmonic (20 MHz) there is a parasitic component with an amplitude of .

import EngeeDSP.Functions: sfdr

deltat = 1e-8
fs = 1 / deltat
t = 0:deltat:1e-5-deltat
x = cos.(2 * π * 10e6 * t) + 3.16e-4 * cos.(2 * π * 20e6 * t)
r = sfdr(x, fs)[1]
70.00625834763413

Let’s output the spectrum of the signal. We will specify the fundamental harmonic, the value of the constant component, the parasitic component and the SFDR.

sfdr(x, fs, out=:plot)

sfdr 1

Minimum distance between parasitic components

Details

Define the SFDR for the tone 10 MHz with amplitude 1, sampled at the frequency 100 MHz. On the first harmonic (20 MHz) there is a parasitic component with an amplitude of . Let’s skip the first harmonic using the minimum distance between the parasitic components. 11 MHz.

import EngeeDSP.Functions: sfdr

deltat = 1e-8
fs = 1 / deltat
t = 0:deltat:1e-5-deltat
x = cos.(2 * π * 10e6 * t) + 3.16e-4 * cos.(2 * π * 20e6 * t) + 0.1e-5 * cos.(2 * π * 25e6 * t)
r = sfdr(x, fs, 11e6)[1]
120.00000000390743

Let’s output the spectrum of the signal. We will specify the fundamental harmonic, the value of the constant component, the parasitic components and the SFDR.

sfdr(x, fs, 11e6, out=:plot)

sfdr 2

Frequency and power of the largest parasitic component

Details

Let’s define the frequency in MHz of the largest parasitic component. The input signal is a tone 10 MHz with amplitude 1, sampled with frequency 100 MHz. On the first harmonic (20 MHz) there is a parasitic component with an amplitude of .

import EngeeDSP.Functions: sfdr

deltat = 1e-8
t = 0:deltat:1e-6-deltat
x = cos.(2 * π * 10e6 * t) + 3.16e-4 * cos.(2 * π * 20e6 * t)
r, spurpow, spurfreq = sfdr(x, 1 / deltat)
spur_MHz = spurfreq / 1e6
20.0

Additional Info

Distortion measurement functions

Details

Functions sfdr, sinad and snr The response of a weakly linear system excited by a sine wave is measured.

When setting the input data in the time domain, the function sfdr builds a periodogram using the Kaiser window with a large attenuation of the side lobes. To find the fundamental frequency, the algorithm searches for the largest nonzero spectral component on the periodogram. Then it calculates the central moment of all neighboring intervals, monotonically decreasing as they move away from the maximum. For detection, the main frequency must be at least in the second frequency bin. If a harmonic is located in a monotonously decreasing region next to another one, its power is considered to belong to the larger harmonic. This large harmonic may or may not be the main one. The algorithm ignores all the power, which decreases monotonously as it moves away from the constant component.

Function sfdr It fails if the fundamental frequency is not the most powerful spectral component of the signal.

Make sure that the frequency components are sufficiently spaced to take into account the width of the side lobes of the Kaiser window. If this is not possible, you can use the flag "power" and calculate the periodogram with a different window.