
FFT from time domain in excel
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Arkar Maw Win
am 23 Jun. 2020
Kommentiert: Star Strider
am 30 Jun. 2020
I am trying to get Frequency domain results from my Time domain analysis data regarding a floating offshore wind turbine responses.
I have learnt that I can use FFT in Matlab to perform this action. Can anybody suggest me how to do FFT and plots with excel file which has over 50000 lines of data?
I have attached one of the xlsx files that I need to FFT. Thank you.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 23 Jun. 2020
There is not much to see in the plot:
D1 = readmatrix('PlatformHeave.xlsx');
t = D1(:,1); % Time Vector
Fs = 1/mean(diff(t)); % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
y = D1(:,2:end); % Signal Matrix
ym = y - mean(y); % Subtract Column Means From All Columns (Eliminates D-C Offset Effect)
L = numel(t); % Signal Lengths
FTy = fft(y)/L; % Fourier Transform (Scaled For Length)
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
sep = ones(numel(Fv),1) * (1:size(FTy,2)); % 'Separation Matrix' — Plots Each Record In Its Column Locatioln
Fm = ones(numel(size(FTy,2)),1) * Fv; % Frequency Matrix
figure
plot3(Fm, sep, abs(FTy(Iv,:))*2)
grid on
xlabel('Frequency (Hz)')
ylabel('Record (Column #)')
zlabel('Amplitude')
set(gca, 'ZScale','log')

.
4 Kommentare
Star Strider
am 30 Jun. 2020
As always, my pleasure!
There are several ways to compute the PSD. I generally use pwelch and leave the details to the function. That is compatible with the code I already wrote for the Fourier transforms and the plots, including the subplots. You would need to change the code slightly to plot the pwekch PSD estimates, since ‘Fv’ and ‘Iv’ are not necessary with it.
To use the subplot function (with the Fourier transforms), I would do something like this:
figure
splim = size(FTy,2);
for k = 1:splim
subplot(splim,1,k)
loglog(Fv, abs(FTy(Iv,k)))
grid
xlim([0 1])
end
The loglog plot is the best way to see the details. I used xlim here to restrict the frequency axis.
The code to plot the pwelch PSD estimates would be similar. Make appropriate changes to get the result you want.
:
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Parametric Spectral Estimation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!