How to use FFT for time series data
72 views (last 30 days)
Show older comments
Matt Thomas
on 14 Aug 2023
Commented: Matt Thomas
on 15 Aug 2023
Thank you all who helped to answer my first question. Now im on to my second question:
using an open source software called openFAST, i have calculated loads over 300 seconds in Kn. The graph below is what it looks like. i use the following code to produce the image
%% Run this command first
%% Read a binary output file
% Read file
outbfile = '5MW_Land_DLL_WTurb.outb';
[Channels, ChanName, ChanUnit, FileID, DescStr] = ReadFASTbinary(outbfile);
time = Channels(:,1);
%%CHange the plot number to reflect the parameter in channel names matrix generated from above command.
% Plot Channel 34
iChan=29
figure()
plot(time, Channels(:,iChan))
xlabel('Time (s)')
ylabel([ChanName(iChan) ChanUnit(iChan)])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1456572/image.png)
I have very little to know knowledge of programming. The above code is example code i found in a user guide.
What i would like to do now is FFT so that i can find the peak frequency of this data. However, i do not know how to do that in matlab or the correct syntax.
thanks for all the help and continued help.
Accepted Answer
Walter Roberson
on 14 Aug 2023
if you have regular times, then
y = fft(Channels(:,iChan));
and see the first example for fft() for code that can calculate appropriate frequency bins.
If you do not have the frequency information but you do have regular time slots then frequency is Fs = 1/mean(diff(time))
If you do not have regular times then see nufft
4 Comments
Walter Roberson
on 14 Aug 2023
Edited: Walter Roberson
on 14 Aug 2023
Your plot lots like it might end at time 300 and you have 48000 samples. If so then
format long g
300/48000
format short
ans
So perhaps your real sample time is 0.00625 but the displaying round it off to 0.0063 ?
Yes, you have 160 samples per second. That does not mean that the wave shape is the same frequency.
Imagine that you had a 40 Hz sine wave, but you sampled it 4 times during each cycle, then the sampling rate would be 160 Hz even though the wave is only 40 Hz.
In the field of signal transmission, if you can sample a wave much faster than the nominal signal frequency, then you have the opportunity to overlay modifications to the basic wave, and so get multiple bits per "symbol". This is an important signalling mechanism in practice.
More Answers (0)
See Also
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!