how do i code toi.m ?

I need to code toi.m in order to find the third order intercept. Could someone guide me in order to code the c equivalent ?

回答(1 个)

MATLAB starts toi with 3 very useful examples:
1.- direct Intercept Point IP3:
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)
2.- IP3 from power spectral density:
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)
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')
3.- IP3 from power spectrum
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)
w = kaiser(numel(y),38)
[Sxx,F] = periodogram(y,w,N,Fs,'power')
toi(Sxx,F,enbw(w,Fs),'power')
4.- Intermodulation products
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)
If you find this answer of any help solving this question, please click on the thumbs-up vote link,
thanks in advance
John

类别

帮助中心File Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by