I am having trouble with all of the forums that I have looked at thus far. I have one day's worth of Sonic Anemometer data. I want to see the spectral analysis of this data. When the anemometer data was being logged it appears that the frequency ranges between 31 and 32 hz. I am looking to analyze this data in thirty minute chunks and I would just like some guidance as to how to go about this.

I have already removed the bad data (stray data points with 98 m/s winds x.x). I am not sure if I am supposed to detrend the data then apply a Hamming window and take the Fourier transform, or if I'm supposed to just apply the Hamming window and then take the Fourier transform.

Also should I calculate the sampling frequency for each 30 minute interval since it appears to change or is that change insignificant? (or should I analyze the whole data set together?)

Sorry for the long post but I have been hacking away on forums all week and I cannot seem to find a consistent solution.

  • $\begingroup$ I do not understand what you mean by removing data samples - if you are not making sure that your processing is of a constant sample rate. What is the bandwidth of your desired signal? Why the windowing? What is your sampling rate? What accuracy you want for your measurement - 31, 31.5, 32..? $\endgroup$ – Moti Jun 5 '15 at 6:04
  • $\begingroup$ You have to remove the irregular data samples. Like I had a few points that were just errors where the u,v, and w values were just logged as extremely high values. Why wouldn't I need to window? Windowing is used when you are taking a subset of a larger dataset and that's what I am doing. I don't know what you mean by what accuracy do I want? I just want to find the -5/3 slope in the inertial subrange for my sonic data. $\endgroup$ – Brittany Phillips Jun 5 '15 at 15:46
  • $\begingroup$ I do not know your background and I really do not know the details of your input data. I know quite well how to use the FFT. I assume that you know that your data contains "a single frequency". Do you have three data streams, u, v, and w? The FFT assumes an equally spaced samples - just removing samples is introducing errors in the frequency measures - it is proffered to replace such high samples with averages to the adjacent samples. Windowing will impact the shape around the frequency bins, so as first cut there is no need for it. It is a refinement. What is your sampling rate? expected S/N? $\endgroup$ – Moti Jun 5 '15 at 16:28
  • $\begingroup$ It seems your question relates to 3D anemometer. Right? $\endgroup$ – Moti Jun 5 '15 at 16:35
  • $\begingroup$ Are you still interested in solving your challenge or have you solved it? $\endgroup$ – Moti Jun 6 '15 at 23:47

take fft of data

let's say data is x = [ 3 4 5 6 6 9 7 ]

take fft

y = fft(x);
shift so -fs/2  to fs/2
y = fftshift(x);
plot mag

see link for help fft Help


– Use one of the standard spectral estimation functions of Matlab to process the data; the best place to start is probably pwelch. That function implements the "modified periodogram" method of spectral estimation, which involves windowing (by default using a Hamming window), Fourier transform & computation of modulus-squared coefficients, and averages over multiple sub-windows.

– If you have to remove outliers, probably the best thing to do is to replace these values with the average of the surrounding data points.

– Whether to detrend the data depends on whether you consider that trend to be an artefact, or as a property of the interesting signal itself. Spectral estimation works either way, you will only get a stronger signal component at low frequencies if you do not detrend.

– If you have reason to believe that your signal is not stationary (has a frequency composition that changes over time), computing spectra on sequential windows is a reasonable approach. If this is done systematically, the result is called a spectrogram, as is the corresponding Matlab function. Whether it makes sense to assume instationarity is something you have to decide based on your background knowledge of the data.

I hope this helps.


I agree with A. Donda's comments regarding outliers and detrending. People use Hanning windows to minimize the "leakage" effect inherent in the discrete Fourier transform. That is, they want to minimize a strong spectral component's leakage from corrupting the spectrum of a weaker nearby-frequency spectral component. Is that why you're using a Hanning window?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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