Amplitude of FFT is not correct

조회 수: 24 (최근 30일)
Meikel Vollmers
Meikel Vollmers 2021년 5월 17일
댓글: Meikel Vollmers 2021년 5월 17일
Hey there,
i want to calculate the power output of a 3 phase inverter. Therefore i have to do a FFT on my voltage Signals, to get the amplitude of the fundamental.
In comparison to the FFT Tool from the Simulink powergui, my amplitude is always lower. I searched for some examples for a correct scaled FFT, but i cant find differences to my code.
f1 = ac_voltage_a.data(SteadyState:1:SteadyState+2^15); % A Timeseries vector is used when system is in steady state
g1 = hanning(length(f1)).*f1; % Using the hanning window
dt=Tsample % Tsample = 1e-6
vac_fenstera_Nfft = length(g1); % Sampled values
J = fft(g1); % FFT
vac_fenstera_sfft = 2*abs(J)/vac_fenstera_Nfft; %
plot(1/dt * (0:(vac_fenstera_Nfft/2-1)) / vac_fenstera_Nfft, (vac_fenstera_sfft(1:vac_fenstera_Nfft/2)));
In comparison to the FFT analysis tool from powergui, the value of my fundamental amplitude is only half the size, even i mutiplied the abs*2.
Where is my fault?
Is it nessesary that the length of g1 is a multiple of 2? I think a DFT could also work out.
Regards
  댓글 수: 4
Jonas
Jonas 2021년 5월 17일
can you provide the data file?
Meikel Vollmers
Meikel Vollmers 2021년 5월 17일
Sure, data file is attached. The fundamental is 1060Hz. Powergui FFT says the amplitude is 333V, my calculation says 167V.
SteadyState = 350000;

댓글을 달려면 로그인하십시오.

채택된 답변

David Goodmanson
David Goodmanson 2021년 5월 17일
편집: David Goodmanson 2021년 5월 17일
Hi Meikel,
You are multiplying your signal times a window, which reduces the signal amplitude. That has to have a significant effect on the fft. The code below shows the effect, which for the (misnamed) hanning window drops the fundamental by a factor of 2.
For an oscillation at one frequency, the peak amplitude in the frequency domain is reduced by a factor equal to the average value of the window function. Since the Hann window is a cos^2 function, and since the average value of cos^2 is 1/2, the frequency domain peak is reduced by that amount.
N = 1000; % signal length
t = (0:N-1)/N;
f0 = 40;
y = cos(2*pi*f0*t)/N;
yH = (cos(2*pi*f0*t)/N).*hanning(N)';
f = (0:N-1);
yf = fft(y);
yfH = fft(yH);
ind = 1:N/2;
figure(1)
stem(f(ind),2*abs(yf(ind)))
grid on
figure(2)
stem(f(ind),2*abs(yfH(ind)))
grid on
  댓글 수: 1
Meikel Vollmers
Meikel Vollmers 2021년 5월 17일
Hey David, thank you for the answer!
Windowing is important, but i have never read about the reduction by the average value of the windowing function. So i will just multiply my spectrum with another factor of 2. Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by