Sampling frequency and FFT output ?
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
What is the relationship between the fs (sampling frequency) and the amplitude of the FFT-function output in matlab? As the amplitude of the FFT output changes as the sampling frequency is changed.
0 commentaires
Réponse acceptée
Plus de réponses (2)
Wayne King
le 12 Oct 2012
Modifié(e) : Wayne King
le 12 Oct 2012
There is a relationship between length of the input signal and the FFT output, not the sampling rate.
Fs = 1000;
t1 = 0:0.001:1-0.001; % 1000 samples
t2 = 0:0.001:0.1-0.001; % 100 samples
x1 = cos(2*pi*100*t1);
x2 = cos(2*pi*100*t2);
xdft1 = fft(x1);
xdft2 = fft(x2);
subplot(211)
plot(abs(xdft1))
subplot(212)
plot(abs(xdft2))
However, if you compute the power spectral density, using something like periodogram(), then the sampling frequency will come into play in scaling the PSD estimate.
Of course, depending on how you sampled the signal (the length and sampling frequency), you may have situations where the frequency does not fall directly on a DFT bin, and the can affect the amplitude.
3 commentaires
Matt J
le 12 Oct 2012
Fs is not used in Wayne's code apart from the first line, so if you only changed the first line, it's understandable that you would see no effect.
However, changing the amplitude of the input signles x1 and x2 can/will obviously affect the amplitude of the output because of the linearity of the FFT.
Wayne King
le 12 Oct 2012
Modifié(e) : Wayne King
le 12 Oct 2012
Obviously the amplitude depends on the amplitude. If you have a sine wave with amplitude A, then in the magnitude plot for the DFT (fft), you are going to get two lines with magnitude (N*A)/2 where N is the number of samples, and A is the amplitude.
t2 = 0:0.001:0.1-0.001;
x2 = 10*cos(2*pi*100*t2);
xdft2 = fft(x2);
% amplitude at -100 and 100 Hz will be (length(x2)*10)/2
plot(abs(xdft2))
The length of x2 is 100, the amplitude is 10, so the magnitude is predictably (10*100)/2. Again, that is not depending at all on the sampling frequency, it is only depending on the length and of course the amplitude.
Voir également
Catégories
En savoir plus sur Spectral Measurements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!