# correlation function vs tensor

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 26, 2022, 20:18 correlation function vs tensor #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 then take the fft in both azimuthal and time directions. I found the correlation in matlab using the built-in function xcorr. 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 notation is a bit confusing to me; later, I must calculate where is used in, I guess is merely used as a dummy integration varaible, but it's throwing me off (because is the second variable in the correlation matrix). Again, , for say is a function only (after all, xcorr is a function of twice the length, plus one, of the origional vectors); how are you going to get a matrix out of that? Are the different lag-positions the different matrix elements? Still, this seems like not a matrix, just a vector. * 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 , then i have a vector, but if i consider the full components (u,v,w), then xcorr is a matrix, right? If i want to correlate in the radial direction only, over all 3 vector fields, will this still use xcorr2(), or just xcorr() ? * 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

 April 26, 2022, 21:44 #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.

 April 28, 2022, 11:46 #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?

 April 28, 2022, 13:12 #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.

 April 28, 2022, 19:36 #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 and , in order to get ? where 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.

 April 29, 2022, 07:54 #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. aero_head and loesung like this.

 April 29, 2022, 14:57 #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 and by . 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.

 April 29, 2022, 19:15 #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. loesung likes this.

 April 29, 2022, 20:00 #9 New Member   Join Date: Mar 2022 Posts: 17 Rep Power: 2 you are perfectly right. f= a*b , I like that Even though this is quite elementary, there's still a lot of moving parts, but I think I have it now. Thanks for your helps

 Tags correlation, matrices, turbulence

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Tushar@cfd OpenFOAM Bugs 0 January 17, 2015 23:19 nennbs OpenFOAM Meshing & Mesh Conversion 7 April 17, 2013 05:42 phsieh2005 OpenFOAM Bugs 25 February 9, 2010 04:37 gschaider OpenFOAM Installation 113 December 2, 2009 10:23 ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50

All times are GMT -4. The time now is 03:48.

 Contact Us - CFD Online - Privacy Statement - Top