How to use FFT for time series data

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)])
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.

2 Comments

REad the documentation of fft. It is clearly explained.
i have read some of it but that is with basic varible name and stuff. the matlab thing i am using is not basic. I have tried
y=FFT((time, Channels(:,iChan)))
and i get errors back.
i have tried y=fft(iChan) and it gives me the number 29 which is the channel name of the time series im looking at.
i do not know anything about syntax or programming to know hwo to setup the syntax at all. Im trying, but its becomming a failure every step of the way to say the least haha.

Sign in to comment.

 Accepted Answer

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

I have tried that syntax as stated above but i get a scalar error and non negitive error. But non of my values are negitive so it doesnt make sense to me :) haha.
the Fs=1/mean(diff(time)) is this a code snipet or something else?
thanks
Matt Thomas
Matt Thomas on 14 Aug 2023
Edited: Matt Thomas on 14 Aug 2023
i do indeed have the time steps. its 0.0063 seconds per cycle and i have 48,000 of them haha. thanks for showing me that tip. I knew F=1/Periode, but never even thought to use 0.0063 seconds as the time for one cycle. my frequency is 158.7 hrz. Now i can use that to find cycles to failure.
i feel like 160hrz is to high though. That means for a 1 second time periode, 160 samples were calculated, thats not the same as the frequency of the wave shape on the graph?
Your plot lots like it might end at time 300 and you have 48000 samples. If so then
format long g
300/48000
ans =
0.00625
format short
ans
ans = 0.0063
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.
thanks for this information. i am actualyl writing anpother post on FFT specifically so i dont keep using this area haha. I think i understand more now than i did earlier haha. I know of FFT but have never used it. i have used laplace alot for linear systems but not FFT

Sign in to comment.

More Answers (0)

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!