I am facing a trouble implementing the fft and appreciate your advice. My data structured as follow: The data are retrieved from the share market for one day change in the share price. The time range from (11:00:00 to 15:00:00) this means 16200 Sec. In matlab its represented as serial so it will be from 0.4584 to 0.6458. Data are not sampled in fixed freqency. Price is sampled only when there is a change in price. For example ( it can be sampled in each second and sometimes in 30 Seconds interval).
For calculating the frequency spectrum of an non-uniformly sampled signal I see two options:
- Interpolate the data in order to obtain evenly spaced samples before taking the FFT as suggested by Hasan. Use the Matlab function
interp1. If you have the Data Analysis toolbox, the
resamplefunction of the
timeseriesclass might be worth a look.
- Use the Lomb–Scargle periodogram. There's no builtin Matlab function but an implementation from Matlab File Exchange exists.