FFT x-axis from samples to frequency
Afficher commentaires plus anciens
hi @ all,
somehow I don't get proper frequency, if I convert the samples to frequency.
The Data which are stored in the output vector were sampled with 320 MHz.
FS = 32000000; %Sample rate
NFFT = length(output); % Output= vector with samples
Y = fft(output,NFFT);
F = FS*(0:NFFT/2-1); % Convert x-axis samples to Frequency
magnitudeY = abs(Y); % Magnitude
dB_mag=mag2db(magnitudeY);
subplot(2,2,3);plot(F(1:NFFT/2),dB_mag(1:NFFT/2));title('Magnitude');
ylabel('Magnitude(dB)');
Réponses (1)
Star Strider
le 23 Août 2021
Try this instead —
Y = fft(output,NFFT)/numel(output);
F = (FS/2)*(0:NFFT/2-1); % Convert x-axis samples to Frequency
Since you are calculating a one-sided fft, the highest uniquely identifiable frequency is the Nyquist frequency, one-half of the sampling frequency. It is also necessary to normalise the fft result by the length of the array being processed, then multiply that result by 2 (that I did not do here) to approximate the original signal amplitudes.
.
Catégories
En savoir plus sur Spectral Measurements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!