toi() - Signal Processing
oip3 = toi(x) returns
the output third-order intercept (TOI) point, in decibels (dB), of
a real sinusoidal two-tone input signal, x. The
computation is performed over a periodogram of the same length as
the input using a Kaiser window with β = 38.
exampleoip3 = toi(x,fs) specifies
the sampling rate, fs. The default value of fs is 1.
exampleoip3 = toi(pxx,f,'psd') specifies
the input as a one-sided power spectral density (PSD), pxx,
of a real signal. f is a vector of frequencies
that corresponds to the vector of pxx estimates.
exampleoip3 = toi(sxx,f,rbw,'power') specifies
the input as a one-sided power spectrum, sxx,
of a real signal. rbw is the resolution bandwidth
over which each power estimate is integrated.
example[oip3,fundpow,fundfreq,imodpow,imodfreq]
= toi(___) also returns the power, fundpow,
and frequencies, fundfreq, of the two fundamental
sinusoids. It also returns the power, imodpow,
and frequencies, imodfreq, of the lower and upper
intermodulation products. This syntax can use any of the input arguments
in the preceding syntaxes.
exampletoi(___) with no output arguments
plots the spectrum of the signal and annotates the lower and upper
fundamentals (f1, f2) and
intermodulation products (2f1 – f2,
2f2 – f1).
Higher harmonics and intermodulation products are not labeled. The
TOI appears above the plot.
Syntax
oip3 = toi(x)oip3 = toi(x,fs) exampleoip3 = toi(pxx,f,'psd') exampleoip3 = toi(sxx,f,rbw,'power') example[oip3,fundpow,fundfreq,imodpow,imodfreq]
= toi(___) exampletoi(___) example
Example
Third-Order Intercept Point of a Two-Tone Nonlinear Signal with NoiseOpen This Example
Create a two-tone sinusoid with frequencies
kHz and
kHz, sampled at 48 kHz. Make the signal nonlinear by feeding it to a polynomial. Add noise. Set the random number generator to the default settings for reproducible results. Compute the third-order intercept point. Verify that the intermodulation products occur at
kHz and
kHz.
rng default
fi1 = 5e3;
fi2 = 6e3;
Fs = 48e3;
N = 1000;
x = sin(2*pi*fi1/Fs*(1:N))+sin(2*pi*fi2/Fs*(1:N));
y = polyval([0.5e-3 1e-7 0.1 3e-3],x)+1e-5*randn(1,N);
[myTOI,Pfund,Ffund,Pim3,Fim3] = toi(y,Fs);
myTOI,Fim3
myTOI =
1.3844
Fim3 =
1.0e+03 *
4.0002 6.9998
Third-Order Intercept Point from Power Spectral DensityOpen This Example
Create a two-tone sinusoid with frequencies 5 kHz and 6 kHz, sampled at 48 kHz. Make the signal nonlinear by evaluating a polynomial. Add noise. Set the random number generator to the default settings for reproducible results.
rng default
fi1 = 5e3;
fi2 = 6e3;
Fs = 48e3;
N = 1000;
x = sin(2*pi*fi1/Fs*(1:N))+sin(2*pi*fi2/Fs*(1:N));
y = polyval([0.5e-3 1e-7 0.1 3e-3],x)+1e-5*randn(1,N);
Evaluate the periodogram of the signal using a Kaiser window. Compute the TOI using the power spectral density. Plot the result.w = kaiser(numel(y),38);
[Sxx, F] = periodogram(y,w,N,Fs,'psd');
[myTOI,Pfund,Ffund,Pim3,Fim3] = toi(Sxx,F,'psd')
toi(Sxx,F,'psd');
myTOI =
1.3843
Pfund =
-22.9133 -22.9132
Ffund =
1.0e+03 *
5.0000 6.0000
Pim3 =
-71.4868 -71.5299
Fim3 =
1.0e+03 *
4.0002 6.9998
Third-Order Intercept Point from Power SpectrumOpen This Example
Create a two-tone sinusoid with frequencies 5 kHz and 6 kHz, sampled at 48 kHz. Make the signal nonlinear by evaluating a polynomial. Add noise. Set the random number generator to the default settings for reproducible results.
rng default
fi1 = 5e3;
fi2 = 6e3;
Fs = 48e3;
N = 1000;
x = sin(2*pi*fi1/Fs*(1:N))+sin(2*pi*fi2/Fs*(1:N));
y = polyval([0.5e-3 1e-7 0.1 3e-3],x)+1e-5*randn(1,N);
Evaluate the periodogram of the signal using a Kaiser window. Compute the TOI using the power spectrum. Plot the result.w = kaiser(numel(y),38);
[Sxx,F] = periodogram(y,w,N,Fs,'power');
toi(Sxx,F,enbw(w,Fs),'power')
ans =
1.3844
Intermodulation Distortion ProductsOpen This Example
Generate 640 samples of a two-tone sinusoid with frequencies 5 Hz and 7 Hz, sampled at 32 Hz. Make the signal nonlinear by evaluating a polynomial. Add noise with standard deviation 0.01. Set the random number generator to the default settings for reproducible results. Compute the third-order intercept point. Verify that the intermodulation products occur at
and
.
rng default
x = sin(2*pi*5/32*(1:640))+cos(2*pi*7/32*(1:640));
q = x + 0.01*x.^3 + 1e-2*randn(size(x));
[myTOI,Pfund,Ffund,Pim3,Fim3] = toi(q,32)
myTOI =
17.4230
Pfund =
-2.8350 -2.8201
Ffund =
5.0000 7.0001
Pim3 =
-43.1362 -43.5211
Fim3 =
3.0015 8.9744
TOI PlotOpen This Example
Generate 640 samples of a two-tone sinusoid with frequencies 5 Hz and 7 Hz, sampled at 32 Hz. Make the signal nonlinear by evaluating a polynomial. Add noise with standard deviation 0.01. Set the random number generator to the default settings. Plot the spectrum of the signal. Display the fundamentals and the intermodulation products. Verify that the latter occur at 9 Hz and 3 Hz.
rng default
x = sin(2*pi*5/32*(1:640))+cos(2*pi*7/32*(1:640));
q = x + 0.01*x.^3 + 1e-2*randn(size(x));
toi(q,32)
ans =
17.4230
Output / Return Value
Limitations
Alternatives / See Also
Reference