0
$\begingroup$

enter image description hereI 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).

Sample of Data

$\endgroup$
1
  • 2
    $\begingroup$ What you're asking for is the DFT of a non-uniformly sampled signal. I suggest you change the title of the question accordingly. The votes to close this question are presumably because of the words 'implement' and 'Matlab'. You should rather ask questions about signal processing in general. $\endgroup$
    – Deve
    Sep 29, 2013 at 11:10

2 Answers 2

4
$\begingroup$

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 resample function of the timeseries class might be worth a look.
  • Use the Lomb–Scargle periodogram. There's no builtin Matlab function but an implementation from Matlab File Exchange exists.
$\endgroup$
2
  • $\begingroup$ If you interpolate or add zeros then you are changing the data Anyway I have tried different kind for data which are sampled each day and run for a year. I always getting a symmetric fftshifted or the FFT have a spicke on zero. I will attach the signal and the FFT on my post. Can you comment please ? $\endgroup$
    – omo tam
    Oct 5, 2013 at 10:43
  • $\begingroup$ Interpolation means "making data up", that's true. If you think it will bias your data, then probably the Scargle perodogram is for you. The question in your comment sounds like a new question. You should therefore aks a new question, I will not discuss it in the comments. $\endgroup$
    – Deve
    Oct 5, 2013 at 12:51
1
$\begingroup$

You can write an algorithm that fills the time gaps with the fixed price. Now you have the price/second. I can't see issues with taking the FFT of this new time series (1:16200).

$\endgroup$
1
  • $\begingroup$ it doesnt make sense to fill the gaps. What would be my bin and my frequency range ? $\endgroup$
    – omo tam
    Sep 28, 2013 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.