CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   autocorrelation in Matlab (https://www.cfd-online.com/Forums/openfoam/176097-autocorrelation-matlab.html)

pappo1890 August 11, 2016 02:53

autocorrelation in Matlab
 
Dear all,

I am trying to plot the energy spectrum from the autocorrelation function. For this aim I am using the velocity fluctuation of a point of the domain varying through the time.
the expression of the autocorrelation from Pope is:
<u'(t)u'(t+s)>/<u'>^2, so in case s=0 the autocorrelation is 1.

The code that I have written in Matlab is:

u_primequad=zeros(n,1);
%autocorr=0;
for i=1:n-1
u_primequad(i,1)=((u_prime(i)*u_prime(i)));
end
u_primequad=mean(u_primequad);


f=zeros(n,1);
autocorr=zeros(n,1);
for j=0:n-1

for i=1:n-j
autocorr(i,1)=(u_prime(i)*u_prime(i+j));
end
autocorr1=mean(autocorr);
f(j+1,1)=autocorr1/u_primequad;
end


Someone can say me if are there some errors?

Thank you in advance

Tobi August 12, 2016 10:12

Hi,

I think you missed the correct forum. This forum is about OpenFOAM and not Matlab (:

calf.Z July 13, 2019 03:06

I am doing DNS of pipe flow, and I am wondering how to do autocorrelation using Matlab? Thank you.

ari003 August 20, 2019 07:03

Quote:

Originally Posted by calf.Z (Post 738829)
I am doing DNS of pipe flow, and I am wondering how to do autocorrelation using Matlab? Thank you.

Did you get how to do it?
I m in a great need.
Will be very helpful if you share.

calf.Z September 4, 2019 03:47

Quote:

Originally Posted by ari003 (Post 742512)
Did you get how to do it?
I m in a great need.
Will be very helpful if you share.

I am still researching it, we can keep contact if we make any progress.

masonchu54321 March 24, 2020 07:22

Quote:

Originally Posted by calf.Z (Post 743794)
I am still researching it, we can keep contact if we make any progress.

Excuse me. Did you get the correct answer? I also encountered the same problem. May you share the solution to this problem for me?


All times are GMT -4. The time now is 13:55.