the Noisy Signal example on fft function have problems?

19 visualizaciones (últimos 30 días)
Yu-Hsun Chiu
Yu-Hsun Chiu el 19 de Mayo de 2023
Comentada: dpb el 20 de Mayo de 2023
i use the fft function's Noisy Signal example, why i change the " S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);" into "S = 0.7*sin(2*pi*5*t) + sin(2*pi*120*t);" the plot on "Single-Sided Amplitude Spectrum of S(t)" don't show the correct amplitude of 5Hz is 0.7 it would showed about 0.43.
More, if i change the "L = 1500; % Length of signal" into "L = 2000; % Length of signal" the plot on "Single-Sided Amplitude Spectrum of S(t)" will be correct anain. i only change the number of these codes. what's wrong with this example ??
  1 comentario
Richard Burnside
Richard Burnside el 19 de Mayo de 2023
I've also been working on fft routines for vibration data and noticed that there is a minimum size of the data set necessary for the fft to produce accurate amplitudes as well as having the sampling rate at least 2x your input signals (Nyquist). I have not worked out the rule of thumb for it but its real. Also there is a minimum signal-to-noise ratio of your input signals necessary for the fft to work in the presense of noise.
Someone will likely come along here who knows the limitiations on size of the data set. I'm curious about it too.

Iniciar sesión para comentar.

Respuesta aceptada

dpb
dpb el 20 de Mayo de 2023
Sampling frequency is only part of it -- the example uses a fixed sampling frequency of 1 kHz which is 1000/50 --> 20X or 1000/120 --> 8.3X the two frequencies so Nyquist is well satisfied (while >2X is the minimum, instrument manufacturers will recomend at least 3-4X for data acquisition if at all possible for better performance). This is the need to be able to capture and adequately analyze the highest frequency content in the signal without aliasing.
But, the energy content of the signal is also dependent upon sampling for a long-enough time; a low frequency signal such as the 5 Hz given here in the modified example takes 10X as long to complete a full cycle as does the 50 Hz signal of the original. 1500/1000 --> 1.5 s which is long enough for 7 cycles, but that's not nearly as many as the high-frequency content...
The other issue is the frequency resolution in the frequency domain -- Fmax --> Fs/2 --> 500 Hz so df --> 500/1500*2 --> 0.667. 5/0.667 --> 7.5 so the peak frequency is exactly halfway between two frequency bins; ergo, roughly half the energy of the input signal is in each of the two adjacent bins. One has to integrate the peak to get the total energy estimate, not just use the one bin peak value. You'll notice that the number of samples and the frequencies were carefully selected in the example to make the frequency bins exactly match the two sample frequencies.
We can illustrate easily...
L=1500; Fs=1000; dt=1/Fs;t=(0:L-1)*dt;T=t(end)
T = 1.4990
S1 = 0.7*sin(2*pi*5*t);S2=sin(2*pi*120*t);
subplot(2,1,1)
plot(1000*t.',[S1(:) S2(:)])
xlim([0 500])
Y1=fft(S1);
P21=abs(Y1/L);
P11=P21(1:L/2+1);
P11(2:end-1)=2*P11(2:end-1);
subplot(2,1,2)
f=Fs*(0:(L/2))/L;
plot(f,P11,'*-')
xlim([0 10])
You can also notice that despite the sampling rate being 8X the 120 Hz, it's still not enough to have a perfectly smooth time waveform for the time trace; notice the uneveness in the min/max peak values that gives it a jagged look whereas the 5 Hz time trace is very smooth...
  1 comentario
dpb
dpb el 20 de Mayo de 2023
NOTA BENE: The choice of 2000 is very useful, 500/2000*2 --> 0.5 Hz resolution; 5/0.5 --> 10 so the clean signal will be 100% in the single bin and match identically in amplitude spectrum.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by