FFT from time domain in excel

2 visualizzazioni (ultimi 30 giorni)
Arkar Maw Win
Arkar Maw Win il 23 Giu 2020
Commentato: Star Strider il 30 Giu 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.

Risposta accettata

Star Strider
Star Strider il 23 Giu 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 Commenti
Arkar Maw Win
Arkar Maw Win il 30 Giu 2020
Hello Sir,
Thank you for your reply on PSD info. Let's say I want to produce both FFT and PSD plots from using the same excel file. Can I extend the code you wrote with more PSD scripts;
psdx = (1/(Fs*N)) * abs(xdft).^2;
psdx(2:end-1) = 2*psdx(2:end-1);
freq = 0:Fs/length(x):Fs/2;
and use subplot to produce multiple plots?
Can you suggest me about PSD scripts for my case?
Have a good day.
Regards,
Arkar
Star Strider
Star Strider il 30 Giu 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.
:

Accedi per commentare.

Più risposte (0)

Tag

Prodotti


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by