energy spectrum - FFT - velocity fluctuations

Hi guys,
I've got some really serious issues. Maybe for you it' s just about basics, but for me it's like being in Hell.:)I've tried to solve this problem over a long time but obviously I have no clue how to do so. I'm a student and for the time beeing at home and bored I kill some time in how to use Matlab. Currenty I'm working on a flow simulation task that drives me somehow a little bit crazy. But that's another story. What I'm looking for is an algorithm that helps me to get the energy spectrum by using the fft function. So far, I've coded some few lines but I'dont get a decent solution. I hope there is anybody out there who can help me. Below you will find the code and a pic:
clear all; close all; clc;
st=1;
et=9000;
%flow data
flow_data=importdata('point_velocity_x.dat'); point_velocity_x=flow_data.data(st:1:et,2); clear flow_data;
%mean values, fluctuations
mean_velocity_x=mean(point_velocity_x); velocity_x_f=point_velocity_x-mean_velocity_x; velocity_x_f2=velocity_x_f.*velocity_x_f;
%Time domain samples=et-st+1; % T=4.088E-07; T_max=(samples-1)*4.088E-07; t=0:T:T_max; % % figure(1); % plot(t,velocity_x_f2);
%Frequency domain f_T=1/T; T_f=f_T/(samples-1); f=0:T_f:f_T;
%Spectrum
Spectrum_x=fft(velocity_x_f2);
%Graph figure(2); loglog(f,Spectrum_x);
ylabel('E(f)'); xlabel('f');
Greetings, Uwe

2 Kommentare

Star Strider
Star Strider am 21 Mai 2017
Because it has been Answered. Accept my Answer, then I’ll delete it, and then you or I can delete your Question.
Rena Berman
Rena Berman am 25 Mai 2017
(Answers Dev) Restored edit

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Star Strider
Star Strider am 13 Apr. 2017

0 Stimmen

I don’t follow everything you’re doing. The problem with the Fourier transform plot is that you have to plot the absolute value. Other problems are that you have to normalise the fft by the length of the original data vector, and multiply the absolute by 2 in the plot. See the documentation on the fft (link) function for help on using it correctly. The code between the first (top) two plot figures is important, especially the calculation of the frequency vector and plotting the appropriate part of the fft.
Spectrum_x = fft(velocity_x_f2)/length(velocity_x_f2);
%Graph
figure(2);
loglog(f, abs(Spectrum_x)*2);

Kategorien

Mehr zu Programming finden Sie in Hilfe-Center und File Exchange

Tags

Noch keine Tags eingegeben.

Gefragt:

am 13 Apr. 2017

Kommentiert:

am 25 Mai 2017

Community Treasure Hunt

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

Start Hunting!

Translated by