You are here : matlabSignal Processingsinad

```exampler = sinad(x) returns
the signal to noise and distortion ratio (SINAD) in dBc of the real-valued
sinusoidal signal x. The SINAD is determined
using a modified periodogram of the same length as the input signal.
The modified periodogram uses a Kaiser window with β = 38.
the sampling frequency fs of the input signal x.
If you do not specify fs, the sampling frequency
defaults to 1.

the input pxx as a one-sided power spectral density
(PSD) estimate. f is a vector of frequencies
corresponding to the PSD estimates in pxx.

the input as a one-sided power spectrum. rbw is
the resolution bandwidth over which each power estimate is integrated.

[r,totdistpow]
= sinad(___) returns the total noise and harmonic
distortion power of the signal.

plots the spectrum of the signal in the current figure window and
labels its fundamental component. It uses different colors to draw
the fundamental component, the DC value, and the noise. The SINAD
appears above the plot.```

Syntax

```r = sinad(x) exampler = sinad(x,fs) exampler = sinad(pxx,f,'psd') exampler = sinad(sxx,f,rbw,'power')[r,totdistpow]

Example

```SINAD for Signal with One Harmonic or One Harmonic Plus NoiseOpen This Example
Create two signals. Both signals have a fundamental frequency of
rad/sample with amplitude 1 and the first harmonic of frequency
.
Create the two signals. Set the random number generator to the default settings for reproducible results. Determine the SINAD for the signal without additive noise and compare the result to the theoretical SINAD.n = 0:159;
x = cos(pi/4*n)+0.025*sin(pi/2*n);
rng default

y = cos(pi/4*n)+0.025*sin(pi/2*n)+0.05*randn(size(n));
powfund = 1;
powharm = 0.025^2;

r =

32.0412

32.0412

varnoise = 0.05^2;

r =

22.8085

25.0515

SINAD for Signal with Sample RateOpen This Example
Create a signal with a fundamental frequency of 1 kHz and unit amplitude, sampled at 480 kHz. The signal additionally consists of the first harmonic with amplitude 0.02 and additive white Gaussian noise with variance
.
Determine the SINAD and compare the result with the theoretical SINAD.fs = 48e4;
t = 0:1/fs:1-1/fs;
rng default

x = cos(2*pi*1000*t)+0.02*sin(2*pi*2000*t)+0.01*randn(size(t));
powfund = 1;
powharm = 0.02^2;
varnoise = 0.01^2;

r =

32.2058

33.9794

Create a signal with a fundamental frequency of 1 kHz and unit amplitude, sampled at 480 kHz. The signal additionally consists of the first harmonic with amplitude 0.02 and additive white Gaussian noise with standard deviation 0.01. Set the random number generator to the default settings for reproducible results.
Obtain the periodogram of the signal and use the periodogram as the input to sinad.fs = 48e4;
t = 0:1/fs:1-1/fs;
rng default
x = cos(2*pi*1000*t)+0.02*sin(2*pi*2000*t)+0.01*randn(size(t));

[pxx,f] = periodogram(x,rectwin(length(x)),length(x),fs);

r =

32.2109

SINAD of Amplified SignalOpen This Example
Generate a sinusoid of frequency 2.5 kHz sampled at 50 kHz. Reset the random number generator. Add Gaussian white noise with standard deviation 0.00005 to the signal. Pass the result through a weakly nonlinear amplifier. Plot the SINAD.
rng default
fs = 5e4; f0 = 2.5e3;
N = 1024; t = (0:N-1)/fs;

ct = cos(2*pi*f0*t);
cd = ct + 0.00005*randn(size(ct));

amp = [1e-5 5e-6 -1e-3 6e-5 1 25e-3];
sgn = polyval(amp,cd);

The plot shows the spectrum used to compute the ratio and the region treated as noise. The DC level and the fundamental are excluded from the noise computation. The fundamental is labeled.Related ExamplesAnalyzing Harmonic Distortion```