where T is the duration of the sample. To get resolution of 0.1 Hz, you need a 10 second long sample. You would need even longer, if you use Welch's method, pwelch(). (Read the help for more on pwelch() is desired.) Since you have sampled the signal at a high rate, I recommend measuring the time between successive upward-sloping zero crossings, and taking the reciprocal of that interval to estimate the frequency of each cycle. Or find T2cross=time between every second positive-sloped zero crossing. Then f=2/(T2cross). Reduce FFT bins by oversampling
10 views (last 30 days)
Show older comments
Yannick Pratte
on 28 Mar 2021
Commented: William Rose
on 29 Mar 2021
We measured the voltage output of a rotating machine (generator) which base frequency is 60 Hz. The acquisition sampling is 20 kHz. The generator frequency is varying in time (can be 60.1, 59.9, etc). My recording length is several minutes and I would like to trace the output frequency of the voltage over the time.
I made a sliding windows where I calculate an FFT over 2*334=668 samples, corresponding to 33.4 msec of approximately 2 cycles at 60 Hz.
With the FFT function, I am not able to acheive the precision of 1/10 Hz.
The frequency bins are 29.94 Hz, 59.88 Hz, 89.82 Hz, for a windows 2 cycles. In order to refine the bins, I will have to enlarge the windows, but it becomes so large that a fluctuation is no longer visible.
Am I missing something?
Is there another method that could be more suitable for the application?
load Va.mat %Contains the variable which is the generator output voltage
T = 50e-6; % Sampling period
Fs = 1/T; % Sampling frequency
L = 2*334; % Length of signal
t = (0:L-1)*T; % Time vector
iter = 5000; %Number of windows
sig = zeros(iter,3);
for i = 1:1:iter
S = Gen_volt_output(i:L+i-1,1); %Sample to be analysed
f = Fs*(0:(L/2))/L; %Freq. bins
Y = fft(S);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
[max_val,index] = max(P1);
frequence = f(index);
sig(i,1) = i;
sig(i,2) = frequence;
sig(i,3) = max_val/sqrt(2);
end
subplot(2,1,1)
plot(sig(:,2))
subplot(2,1,2)
hold on
plot(sig(:,3))
plot(Gen_volt_output(1:iter))
hold off
0 Comments
Accepted Answer
William Rose
on 28 Mar 2021
When you do a standard FFT, the output frequency spacing is
where T is the duration of the sample. To get resolution of 0.1 Hz, you need a 10 second long sample. You would need even longer, if you use Welch's method, pwelch(). (Read the help for more on pwelch() is desired.) Since you have sampled the signal at a high rate, I recommend measuring the time between successive upward-sloping zero crossings, and taking the reciprocal of that interval to estimate the frequency of each cycle. Or find T2cross=time between every second positive-sloped zero crossing. Then f=2/(T2cross).
where T is the duration of the sample. To get resolution of 0.1 Hz, you need a 10 second long sample. You would need even longer, if you use Welch's method, pwelch(). (Read the help for more on pwelch() is desired.) Since you have sampled the signal at a high rate, I recommend measuring the time between successive upward-sloping zero crossings, and taking the reciprocal of that interval to estimate the frequency of each cycle. Or find T2cross=time between every second positive-sloped zero crossing. Then f=2/(T2cross). Of course this will not be exactly correct if the baseline is drifting or if the signal is not centered on zero, so adjust accordingly, if needed.
3 Comments
More Answers (0)
See Also
Categories
Find more on Spectral Measurements 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!