MATLAB: How to extract magnitude and phase of a particular frequency using FFT

fftphase and amplitude

I have a recording of signal of 2 seconds sampled at a frequency of 20000 Hertz. the signal has different frequncies and I wold like to obtain the magnitude and phase of this signal at a particular frequency using FFT.

Best Answer

See the R2015a documentation for fft. The code between the first two plot figures is essentially all you need to do to analyse and plot the Fourier transform of your signals. The frequency vector used for the plot has specific frequencies at which the discrete Fourier transform is evaluated. To get the phase information, use the angle function.
If you need the frequency content for a frequency that is not one of the frequencies in the frequency vector, use the interp1 function. You can do that for both the amplitude and phase vectors.