FFT to get noise
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
Can anybody explain how the fft is done in case of data points? I am meassuring 50Samples per second , with 50Hz for 1 second. Well, I got a Little help from an user, but I do not understand what was done in the code. the code Looks like this:
Fs = 50; %Sampling Frequency
T = 1/Fs;
L = 50; %Signal length
Y = fft(voltage);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
plot(f,P1)
I don't understand why the code Looks like this? It seems, that the fft is done for half of the signal. Can anybody give me an example please how it is done for the whole Signal?
0 comentarios
Respuesta aceptada
Adam
el 20 de Mzo. de 2017
The fft is done on the whole signal:
Y = fft( voltage );
but this gives a 2-sided spectrum of positive and negative frequencies. For analysis in the frequency domain people usually just want to look at the positive frequencies in the first half of the result.
doc fft
gives examples. It's always a good idea to read the help!
Más respuestas (1)
Felifa
el 21 de Mzo. de 2017
1 comentario
Adam
el 21 de Mzo. de 2017
P2 = abs(Y/L)
is giving you the spectrum. The fft result, Y, is complex as you note, but for analysis in the frequency domain we are rarely interested in the complex signal, we wish to look at the power or magnitude spectrum telling us the relative power at the different frequencies, hence the abs.
The division by L and the doubling of the positive frequency powers is all concerned with getting the scaling correct and retaining the full power of the signal. For purely looking at relative contributions at different frequencies it doesn't matter, but if you are applying a filter and converting back to the time domain or some other kind of quantitative analysis then the correct scaling does matter.
Ver también
Categorías
Más información sobre Spectral Measurements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!