0

I'm currently doing a fluid simulation. The flow is calculated in discretized steps of 0.0625 s. I think the flow is periodic in all points because it is periodic in some points.

I also calculated the Fourier Transform of this. There was a minor peak at 0.5356 Hz (and some more at higher frequencies). So the period is 1.8671 s. This was consistent with the corresponding signal.

But now I want to prove that this counts for all the nodes of my mesh (around 7000 nodes). Is there a fast way for doing this in MATLAB?

Thanks

(I would have loved to add pictures but I couldn't)

Gastón Bengolea
  • 855
  • 6
  • 13

1 Answers1

0

Yes.

If the input X is a matrix, Y = fft(X) returns the Fourier transform of each column of the matrix. This is considerably faster than looping through each column and calling fft(x) one at a time.

You will need to reshape your input data into a 2-D matrix, where the row dimension is time, for the analysis.

Max
  • 2,121
  • 3
  • 16
  • 20
  • But I want to do this for 7000 nodes. Is this realisable in Matlab? And how do i control this? If i plot it all on one plot, it will probably be quite a mess. Isn't there some simple metric to see if the signal is periodic? – user3329103 Mar 04 '14 at 12:40
  • I tried what you said. The answer (srry that i can't post the figure but my reputation is too low) is a frequency spectrum for all the nodes consisting of 6 peaks. The biggest one is at 0Hz, then 5.1Hz , 5.5 Hz and then 0.56Hz. The smallest are at 6.2 Hz and 1 Hz. Can I now be sure that this means my flow is periodic since there are only 6 peaks and the sampled time is bigger than the time period? – user3329103 Mar 04 '14 at 13:26
  • In answer to your first question: I don't know how many time steps you have simulated, but a thousand or so Matlab should handle easily - it looks like you found this out yourself. – Max Mar 04 '14 at 13:59
  • The second question is more difficult to answer. Are you calculating the amplitude (magnitude) of each frequency bin and looking for peaks? Then the peaks are probably real - but you need to be sure your time steps are short enough, and that your simulation is numerically stable, before you can decide if the actual flow is periodically varying. – Max Mar 04 '14 at 14:04
  • You might also try calling `detrend(X, 'constant')` before the FFT. This will subtract the mean of each column which should largely remove the zero frequency peak. – Max Mar 04 '14 at 14:06
  • Detrend makes the peak smaller from 7 to 5, but it doesn't remove it. Does this mean anything? – user3329103 Mar 04 '14 at 14:43
  • It's not really significant, it just means there is a significant amount of variability at the very lowest frequencies - a period comparable to the length of time you have simulated. – Max Mar 04 '14 at 15:05