|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
Join Date: Mar 2022
Posts: 17
Rep Power: 2 ![]() |
* 1. Quick Problem Description:
My papers describe a 'correlation matrix', how can I get that, since matlab's xcorr gives a correlation in vector form? This is causing issues, because I have to multiply by the parameters r and r', as described below, and these parameters are the correlation's spatial value and spatial offset. * 2. Full Background of Problem and Notation I am doing a proper orthogonal decomposition (POD) of streamwise velocity data. For that, I compute ![]() In other words, I find the correlation ![]() ![]() matlab's xcorr is a function, but papers (1) indicate that is a matrix. Am I supposed to organize the correlation function in a matrix, for different spatial offset values? In particular, the ![]() ![]() where ![]() ![]() I guess ![]() ![]() Again, ![]() ![]() * 3. Possible Solution: I've read elsewhere that for a statistically stationary signal, the cross-correlation of a signal is given by a Toeplitz matrix (basically, a highly specific symmetric matrix), whose entries are the correlation fucntions at different points. * Possible Solution 2 wikipedia gives for cross-correlation the matrix, ![]() What is this matrix in terms of xcorr? My guess is that, in terms of autocorrelation on the streamwise variable in the radial direction, ![]() so, basically just rearrange each of the 2*m -1 entries of the vector given by xcorr(), is this the correct approach? But, Should I be using matlab's xcorr2() ? I don't think so, but just dont know how to express the matrix by using xcorr ! Since i've been considering only the streamwise vector component ![]() * Link to Source Material * Image of paper page: https://i.imgur.com/rZpBM7R.png * Paper (1) url (publicly available): https://arc.aiaa.org/doi/pdf/10.2514/1.31074 * matlab xcorr documentation https://www.mathworks.com/help/matlab/ref/xcorr.html |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 4,850
Rep Power: 57 ![]() ![]() ![]() |
Velocity is a vector. In 3D it has 3 components x,y,z (or u,v,w). The correlation tensor consists of 9 pairwise correlations: Ruu,Ruv,Ruw,Rvu,Rvv,Rvw,Rwu,Rwv,Rww. Of course only 6 of them are independent. If you have a 2D or 1D vector then you get subsets of these.
When you read material that discusses cross-correlation for fluid problems, pay attention to whether they are define cross-correlation as between scalars or between vectors. The notation has to change accordingly. Matlab's xcorr operates on pairs of scalar variable. But to add to the confusion.... the default memory structure of a ranged variable in matlab is a vector. This is a memory vector, not a physical velocity vector. It's two different kinds of vectors. xcorr2 also takes correlations between two scalars except it allows for 2D memory structures. |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Join Date: Mar 2022
Posts: 17
Rep Power: 2 ![]() |
Thanks for your reply, that part is clear now!
Does it matter what order I take fft and xcorr in? Meaning, if i take fft in x, and then xcorr in r, that is , exactly the same as taking first xcorr in r, then taking fft in x? Also, if the flow direction is in x-dir, then I should get almost the same POD modes (eigenvectors) if I just use S_{rr}, instead of the full correlation components? |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 4,850
Rep Power: 57 ![]() ![]() ![]() |
The convolution theorem gives you the relationship between the cross-correlation and fourier transoform.
Also the subscript and index for the correlation tensor and shape function (i,j,k) is x,y,z or u,v,w; it is not r. r is an argument. If velocity is in x,y,z and you close your eyes and pretend there is no y or z velocity and do the POD, then you calculate a subspace of POD modes, you calculate only one of the eigensubspaces. |
|
![]() |
![]() |
![]() |
![]() |
#5 |
New Member
Join Date: Mar 2022
Posts: 17
Rep Power: 2 ![]() |
Okay, so can I even use xcorr here (in radial direction), along with two applications of fft in
![]() ![]() ![]() ![]() Or must I multiply the twice fourier-transformed signals by each other, one of them being complex conjugated (and therefore using matlab's xcorr would be invalid)? Currently, it seems that I can use either xcorr, or if one alternately wishes, multiply the twice fft'd signals by each other (one of them being * conjugated).. Last edited by loesung; April 28, 2022 at 22:01. |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 4,850
Rep Power: 57 ![]() ![]() ![]() |
I recommend you to look at the user manual at what xcorr actually does... It takes the fft and....
Almost nobody brute forces the cross correlation calculation using a sliding inner product because it's operationally very very very slow. Following this, I also recommend you to read up on POD instead of blindly following the method proposed in one single paper which is described for a very specific scenario where the system is homogeneous about theta. In particular, you need to understand how to set up the eigenvalue problem. |
|
![]() |
![]() |
![]() |
![]() |
#7 |
New Member
Join Date: Mar 2022
Posts: 17
Rep Power: 2 ![]() |
Yes, I printed out matlab's xcorr code and stepped though it as well. Actually, I had to modify it, multiplying each signal
![]() ![]() ![]() ![]() Note also, this book suggest I do not have to calculate xcorr at all, in order to get the cross power spectral, that is done instead via circulant convolution/correlation: ![]() Also, I agree with not myopically reading one paper. So in my case i have read 80+ POD papers so far (the paper I posted was one of the ancillary papers), and several signal processing books I posted here to completely remove my FUD, after compiling and reading about 30 POD and xcorr related posts on the cfd-online forum! Thanks Last edited by loesung; April 29, 2022 at 17:23. |
|
![]() |
![]() |
![]() |
![]() |
#8 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 4,850
Rep Power: 57 ![]() ![]() ![]() |
You say you have read 80+ POD papers. Cool, so you are well-versed in POD. You say you have read the documentation for xcorr. Cool, so you know how xcorr works. You're asking if it is okay to not use xcorr and instead just take the Fourier transforms... But xcorr does exactly that!
It's like saying given f(a,b)=a*b, instead of calculating f can I just multiply a and b instead? I don't know what to tell you. Now if you're wondering why xcorr does not actually calculate any correlation... it's because the Convolution Theorem tells you they are equivalent + the first F in FFT means fast. |
|
![]() |
![]() |
![]() |
![]() |
#9 |
New Member
Join Date: Mar 2022
Posts: 17
Rep Power: 2 ![]() |
you are perfectly right. f= a*b , I like that
![]() ![]() |
|
![]() |
![]() |
![]() |
Tags |
correlation, matrices, turbulence |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Tensor - function error | Tushar@cfd | OpenFOAM Bugs | 0 | January 17, 2015 23:19 |
[blockMesh] non-orthogonal faces and incorrect orientation? | nennbs | OpenFOAM Meshing & Mesh Conversion | 7 | April 17, 2013 05:42 |
latest OpenFOAM-1.6.x from git failed to compile | phsieh2005 | OpenFOAM Bugs | 25 | February 9, 2010 04:37 |
Version 15 on Mac OS X | gschaider | OpenFOAM Installation | 113 | December 2, 2009 10:23 |
Problem with compile the setParabolicInlet | ivanyao | OpenFOAM Running, Solving & CFD | 6 | September 5, 2008 20:50 |