FINDING DETERMINANT OF MATRIX AFTER TAKING COVARIANCE

4 Ansichten (letzte 30 Tage)
x
x am 25 Aug. 2011
Z=cov(x);
disp(Z);
ans:cov
0.3333 0.4167 0.2500
0.4167 0.5833 0.3750
0.2500 0.3750 0.2500
G=det(Z);
disp(G);
detr
2.2407e-018 determinant value obtained manually and in calci is -1.5625*(10^-6). using det after covariance producing wrong ans. help me how to take a matrix (3*3), then take covariance and for that want to take determinant.... help me in this

Antworten (3)

Oleg Komarov
Oleg Komarov am 28 Aug. 2011
disp(Z)
displays only a fixed number of significant digits depending on the format, i.e. 4 in this case.
try:
format long
disp(pi)
format short
disp(pi)
  3 Kommentare
Oleg Komarov
Oleg Komarov am 28 Aug. 2011
First, use comprehensible english.
Second, what's pgm and pblm?
Oleg Komarov
Oleg Komarov am 28 Aug. 2011
Your cov matrix is stored with precision up to the 16 decimal places, after that floating point approximation "kicks in" (not MATLAB dependendant).
Unless you specify more clearly what constitutes problem for you, I would say yes, no problem. Use cov and then det.

Melden Sie sich an, um zu kommentieren.


Honglei Chen
Honglei Chen am 29 Aug. 2011
As Oleg mentioned, I think this is a precision thing. I'm curious what is the original number you put in as x. Based on the number you are given, I tried to put in the fraction as the input to det and it works fine
>> det([1/3 5/12 1/4;5/12 7/12 3/8;1/4 3/8 1/4])
ans =
1.1565e-18
  1 Kommentar
x
x am 7 Sep. 2011
atually x can be any of the matrix, the determinant value after taking covariance is not as same as manual calculation..format long short problem may be this but can i continue this step as it is..or want 2 do any modification?

Melden Sie sich an, um zu kommentieren.


Mike Hosea
Mike Hosea am 7 Sep. 2011
I can give you a quick manual calculation of det(cov(x)). It's just 0. The problem is that determinant is not well-behaved in finite precision arithmetic. If you matrix is badly scaled and the exact answer is zero, your calculated determinant will be entirely composed of numerical noise. All of these answers are noise:
>> x = cov(rand(3))
x =
0.147692200988288 0.095764562838736 0.073054502962085
0.095764562838736 0.063238321621117 0.049927796895473
0.073054502962085 0.049927796895473 0.041859114554002
>> det(x)
ans =
5.736287575505627e-21
>> det(100*x)
ans =
5.454390014652211e-15
>> det(1e6*x)
ans =
0.008592762115391
>> det(1e10*x)
ans =
6.898406910429394e+09
I'm not aware of any good reasons to calculate the determinant of a matrix numerically. For example, use the RANK function to determine whether a matrix is singular. -- Mike

Community Treasure Hunt

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

Start Hunting!

Translated by