Obtaining amplitude values from an FFT
Show older comments
Hi there, I have made a single-sided spectrum using FFT of a time-domain signal. From that FFT, I would like to somehow get the amplitude at each of the frequencies from the signal.
If I am outputting an FFT that looks like the attached plot, which has about 4 distinct peaks, what should I do with this plot to get amplitude? I got it using
S = fft(eta)
P2 = abs(S/nFFT);
Where nFFT is the number of sampling points and eta is a time-domain signal.
Accepted Answer
More Answers (1)
dpb
on 6 Oct 2016
If have Signal Processing toolbox, see
doc findpeaks
Otherwise, peaks cannot be found easily simply by comparing values. Use trend data to identify peak locations. A peak happens when the slope sign changes from +ive to -ive, i.e., a peak is where the difference changed from a streak of positives and/or zeros to negative. In your sample, peaks are quite well defined and not very noisy at all; this won't be terribly difficult.
I'm sure there are some peak-finding routines to be found on File Exchange if you don't have the SP Toolbox that could save some effort but I don't have a direct link at hand.
2 Comments
dpb
on 6 Oct 2016
[Moved from Answer to Comment--dpb]
Hi dbp,
Thanks for your answer. Ok I've used findpeaks before but then I was confused when using it how to know what the units are or how to output an actual amplitude value. Can you offer any advice on this?
Thanks!
dpb
on 6 Oct 2016
Not sure why the confusion??
>> help findpeaks
findpeaks Find local peaks in data
PKS = findpeaks(X) finds local peaks in the data vector X. ...
[PKS,LOCS]= findpeaks(X) also returns the indices LOCS at which the peaks occur.
...
The value(s) of the peak(s) is(are) the default return; you can also find where to look up frequency from the second index optional return.
The magnitude is dependent upon the units of the signal you passed into fft and how you normalized it.
It is peculiar how you got a one-sided spectrum looking like the attached figure from the code snippet posted; I presumed that was not the actual code but only a partial outline or the figure isn't that you actually have but from some other source???
There's an example in
doc fft
of the normalization and how to get the one-sided PSD from the full 2-sided transform.
A detailed analysis of the relationships is found at <introduction-to-communication-control-and-signal-processing_chap10.pdf>
Categories
Find more on Fourier Analysis and Filtering 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!