multi tone, different psd power
Show older comments
Hi, i am trying apply 4 frequencies tone to analyze spectrum.
Fs=1e6 dt=0:1/Fs:1-1/Fs Pc_amp=200e-6 f_ch_w=2000 ch_num=1 fc1=1000 fc2=fc1+1*ch_num*f_ch_w fc3=fc1+2*ch_num*f_ch_w fc4=fc1+3*ch_num*f_ch_w Pc=Pc_amp.*(cos(2*pi*fc1.*dt)+cos(2*pi*fc2.*dt)+cos(2*pi*fc3.*dt)+cos(2*pi*fc4.*dt))
L = length(Pc); Out_FFT_base = Pc; NFFT = 2^nextpow2(L); na=1 w=hanning(floor(L./na)); Out_FFT_base(L+1:NFFT)=zeros(1,NFFT-L); [Py_base,Fy] = pwelch(Out_FFT_base, w, 0, [], Fs);
but, not equal power@ 4 frequency components. may somebody help it?
Answers (1)
Δf=NFFTFs=1,048,5761,000,000≈0.953674 Hz
Because Δf is not an integer divisor of the tone frequencies, none of the tones fall exactly on an FFT bin center, if you use L as NFFT, it is as expected
Fs = 1e6;
dt = 0:1/Fs:1-1/Fs;
Pc_amp = 200e-6;
% Tone frequencies
fc1 = 1000;
fc2 = 3000;
fc3 = 5000;
fc4 = 7000;
Pc = Pc_amp .* (cos(2*pi*fc1*dt) + cos(2*pi*fc2*dt) + ...
cos(2*pi*fc3*dt) + cos(2*pi*fc4*dt));
L = length(Pc);
NFFT = L;
w = hanning(L);
[Py_base, Fy] = pwelch(Pc, w, 0, NFFT, Fs, 'power');
% Theoretical power per tone: (Pc_amp^2)/2 = 2e-8 V^2
plot(Fy, Py_base);
xlim([0 10000]);
grid on;
ylabel('Power (V^2)');
xlabel('Frequency (Hz)');
Categories
Find more on Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!