MATLAB: Spectral analysis of time versus signal data using FFT

time fft

Hi, I have data for time (x) and signal (y) which i've read into an matrix:
time = squeeze(input(1,:)); signal = squeeze(input(2,:));
How can I perform a FFT on this matix data?

Best Answer

It looks like from your squeeze() commands that time and signal are both just row vectors: 1xN
Do you really have a matrix here?
If signal is just a row vector (or column), then just
signalDFT = fft(signal);
gives you the discrete Fourier transform.
If you use fft() on a matrix, it will naturally take the DFT of each column. You don't want to take the Fourier transform of the time vector, that is not going to give you anything useful.
If you really want a time-frequency analysis (spectral information with some time localization), then use spectrogram on the signal vector.