I am currently doing an FFT on a very large amount of vibration data, which I am going to sample with no pattern which I want to PSD eventually

My question is in essence can I go from my data

[1, 3, 5, 10, 2, 4, 3 , 23, 24]

then sample it to

A = [0, 0, 5, 10, 0, 0, 0, 23, 24]

If I fft(A), will it give me the same answer as if I fft(B), where

B = [5, 10, 23, 24] 

I think this is fine because if A[n] = 0 it provides no contribution to the sum in the DFT but this feels very wrong and I don't know anywhere near enough about this stuff to feel confident.

I can't access data set A because the way my data is sampled can only give me B.

More detail:

I have very large time series data for vibrations caused by air flow over an object, I am trying to parse that data to identify what happens to the vibrations at specific wind speeds and wind directions (this is the sampling I am talking about, and why its sporadic) .

However the data comes in a strange file format (.gcf) which I can only deal with using obspy, and the only way I can find to sample the data (because there is so much and my computer is rubbish) is using obspy's trim() function, which essentially deletes the rest of the not useful data. (I know this is stupid but I cant find a better way) And so this is what is reducing the dimension of the data .

And the end goal is to create a PSD plot but the problem is the fft really.

  • $\begingroup$ not quite sure what you mean with "no pattern"? Do you mean "in regular intervals, but with values being "left out"? $\endgroup$ Mar 1, 2019 at 11:41
  • $\begingroup$ and regarding "will the FFT of A be the same as the FFT of B?": Well no, and have why haven't you simply tried? $\endgroup$ Mar 1, 2019 at 11:42
  • $\begingroup$ I mean, I have no idea how you're comparing these two: The FFT of B has a length of 4, the FFT of A has a length of 9. So, the results can't even be the same on a purely dimensional basis. $\endgroup$ Mar 1, 2019 at 11:43
  • $\begingroup$ basically this is data per unit time, but im sampling it by another characteristic which will be completely irregular, $\endgroup$ Mar 1, 2019 at 12:16
  • $\begingroup$ I can't try it because like I say I cant get access to A, becuase of the size of the dataset $\endgroup$ Mar 1, 2019 at 12:17

1 Answer 1


A = [0, 0, 5, 10, 0, 0, 0, 23, 24]

If I fft A, will it give me the same answer as if I fft B, where

B = [5, 10, 23, 24]


The reason for this is not in what effect does the sample has to the amplitude but in that you would effectively be changing the phase. That is, the relative timing of the sample with respect to the rest.

The Discrete Fourier Transform for a sequence of samples is:

$$ X_k = \sum_{n=0}^{N-1} x_n \cdot \left(\cos\left(\frac{2 \pi kn}{N}\right)-i \sin\left(\frac{2 \pi kn}{N}\right)\right)$$


  • $x_n$ is the $n^{th}$ sample of your data sequence $x$ (your vibration data)
  • $N$ is the length of the sequence

Given the sequence:

$$A = [0, 0, 5, 10, 0, 0, 0, 23, 24]$$

Each sample occurs at a rate of $\frac{1}{N}$. Consequently, the $\cos, \sin$ functions "catch" a given sample at a precise timing which contributes to the weighting to the sum.

For example:

  • The value of $10$ occurs at $n=3$ which means that the argument of the trigonometric functions at that time instant would be $\frac{2 \pi k 3}{9} = \frac{2 \pi k}{3}$.
  • This means that during your summation, when you are assessing how much does that particular sample contribute to a sinusoid of frequency $k$, you will be catching that sinusoid at phase $k \cdot \frac{2 \pi}{3}$. The value $10$ occurs at $n=3$ and that sample at that amplitude and position in time contributes $\cos(1 \cdot \frac{2 \pi}{3})$ to a sinusoid of frequency $k=1$, $\cos(2 \cdot \frac{2 \pi}{3})$ to a sinusoid of frequency $k=2$ and so on (and of course, respectively to the sum corresponding to $\sin$).

  • By isolating certain samples from $A$ to construct a $B$ vector that does not respect the relevant timings, you are altering the time instant that a $\cos,\sin$ at some frequency $k$, "catches" the sample. Very simplistically, if the sample catches the $\cos, \sin$ at a peak, it contributes $1.0$, if it catches it at a "nodal point" it contributes $0$. If you start moving the samples around without respecting their original positions in the time series, your sums are not going to be "right".

So, what do we do?

Two things:

  1. You need to become familiar with the concepts of normalised frequency and the DFTs "frequency resolution".

    • The fact that you have DFT's of different lengths on its own does not permit you from comparing the two frequency distributions. All that you have to do is evaluate the shorter DFT with more points (but with the same sampling frequency).
  2. There is nothing stopping you from applying an "irregularly" sampled DFT as long as you also preserve the timing of the sample. That is, instead of creating a $B$ that is a vector, you need to create a $B$ that is a $N \times 2$ "vector" where the first column is the time instance that the sample occurs and the second column is the amplitude of the signal at that time instance.

Number 2, would be the most straightforward way to get to what you are after. Another thing that you can do is to take the irregular samples and "resample" them on to a regular grid. You can do this with a number of ways but it basically boils down to interpolation.

Hope this helps.

  • $\begingroup$ This is exactly what I wanted to know, thank you $\endgroup$ Mar 1, 2019 at 13:00
  • $\begingroup$ @StephenJ Glad to hear you found this helpful, you can upvote or accept the answer too from the controls on the left of the answer and then it would stop circulating the board as "unanswered". $\endgroup$
    – A_A
    Mar 1, 2019 at 13:02

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.