I have two waves in the field of time, of which I need to measure the coefficients in MATLAB. I max (ABS (MC, N, 'COF'))
but it is not working properly.
In addition to this I need to measure the different types of wave Measure cross correlation coefficient for classes, eg cross correlation coefficient at 1 minute interval, and if these values are matte Rex or something else.
I know that there is a lot to ask, but I am a MATLAB novice and this task seems challenging!
With any help you can give me
Edit: This code is used to test the correlation code:
X = Rand (1,14400); Y = RAND (1,14400); R = Max (stomach (xx (x, y, 'cof')))
< Div class = "post-text" itemprop = "text">
you According to switch to equations such as the cross-correlation coefficient can be counted:
% Say: m and n row vectors r = cov ([m your signals; N]) / (std (m) * std (n));
If you want to calculate the coefficients for some part of the signal, just use it:
r = cov ([m (1 : 100); N (1: 100)] / (STD (M (1: 100)) * STD (N (1: 100)));
Have you also tried the
Edit OK, I have checked the corrcoef function and it's working properly, take a look:
& Gt; & Gt; X = 100 * randon (1000,1); & Gt; & Gt; Y = 34 * randn (1000,1); & Gt; & Gt; Corrcoef (x, y) ans = 1.0000 -0.0543 -0.0543 1.0000
Then the correlation coefficient is equal to -0.0543 - small similarity (expected). To check, let's count the coefficients of the same signals:
& gt; & Gt; Y = x; & Gt; & Gt; Corrcoef (x, y) ans = 1 1 1 1
As expected, it is equivalent to 1.
Edit As you can see, the result of corrcoef is the matrix of all possible correlation coefficients between these two signals:
xyx 1.0000 -0.0543 y -0.0543 1.0000
For cross-correlation you must choose one of the elements outside the main diagonal (self-correlation coefficient, in this case always equal 1 ).
There is no difference if you choose ans (2, 1) or ANS (1,2) - there is no difference, if you calculate the correlation of x and y, or correlate y and x Are there.
The last code should look like this:
R = corrcoef (x, y); % Correlation matrix R = R (2,1); % This is your cross-correlation coefficient
No comments:
Post a Comment