# Performing FFT in Matlab [closed]

set of signals containing time and amplitude was given to me and asked to process the signal with the help of FFT function. I need help in converting the signal to frequency domain and to extract the feature from the signal so that I can compare the test signal with the given signal so the signal is a fault signal or not

• Please edit your question and transform it into proper sentences. Then add context, the data, what have you researched so far, what where your results, and what specifically is your question. This way we may help. – Juancho Mar 30 '17 at 19:12

If doing this in Matlab the command is fft(x) where x is your signal. Note that the result will be presented as a complex frequency vector of N points (or bins) from 0 to N-1. Bin 0 is representative of the DC term and bin N-1 is 1 bin less than your sampling rate. Due to aliasing in digital sampling, this also represents the first negative frequency bin. Often we wish to view the spectrum with DC in the center with the positive and negative half spectrums. To do this easily in Matlab use fftshift:

out = fftshift(fft(y))


Also note that out will be complex, so you may want to view magnitude and phase separately:

mag = abs(out)


or

magdB = 20*log10(abs(out))


phase = angle(out) <- in radians.

Hope that helped!

Simply with a simple call to the fft.m function. For a simple display, you can try the downloadable code FFTR.m: it shows the correct half of the spectrum, the graph units, and a correct amplitude scaling.

For a quick display:

FFTR(data,time_Sampling);


Once you show the signals and their FFTs, and explain your needs, we could help you further.