Filter löschen
Filter löschen

can anybody help to check my matrix is semidefinite positive or not

4 Ansichten (letzte 30 Tage)
vikas Kumar
vikas Kumar am 29 Jul. 2019
Kommentiert: vikas Kumar am 30 Jul. 2019
summation =
1.0e-07 *
Columns 1 through 11
0.2140 0.0972 0.0986 0.0953 0.0934 0.0985 0.0980 0.0985 0.0927 0.0967 0.0611
0.0972 0.2102 0.0976 0.0948 0.0929 0.0975 0.0972 0.0976 0.0922 0.0961 0.1044
0.0986 0.0976 0.2166 0.0953 0.0931 0.0996 0.0986 0.0995 0.0924 0.0970 0.1060
0.0953 0.0948 0.0953 0.2012 0.0914 0.0953 0.0953 0.0955 0.0908 0.0944 0.1013
0.0934 0.0929 0.0931 0.0914 0.1910 0.0932 0.0934 0.0934 0.0893 0.0925 0.0984
0.0985 0.0975 0.0996 0.0953 0.0932 0.2166 0.0985 0.0993 0.0925 0.0970 0.1064
0.0980 0.0972 0.0986 0.0953 0.0934 0.0985 0.2140 0.0985 0.0927 0.0967 0.1057
0.0985 0.0976 0.0995 0.0955 0.0934 0.0993 0.0985 0.2166 0.0928 0.0971 0.1066
0.0927 0.0922 0.0924 0.0908 0.0893 0.0925 0.0927 0.0928 0.1872 0.0919 0.0975
0.0967 0.0961 0.0970 0.0944 0.0925 0.0970 0.0967 0.0971 0.0919 0.2080 0.1036
0.0450 0.1044 0.1060 0.1013 0.0984 0.1064 0.1057 0.1066 0.0975 0.1036 0.2280
0.1058 0.0489 0.1061 0.1013 0.0984 0.1064 0.1058 0.1066 0.0976 0.1036 0.1072
0.1057 0.1043 0.0329 0.1012 0.0984 0.1064 0.1057 0.1066 0.0975 0.1035 0.1071
0.1058 0.1044 0.1061 0.0552 0.0985 0.1065 0.1058 0.1066 0.0976 0.1036 0.1073
0.1058 0.1044 0.1061 0.1013 0.0554 0.1064 0.1058 0.1066 0.0976 0.1036 0.1073
0.1057 0.1044 0.1060 0.1012 0.0984 0.0362 0.1057 0.1066 0.0975 0.1036 0.1071
0.1057 0.1044 0.1060 0.1013 0.0984 0.1064 0.0450 0.1066 0.0975 0.1036 0.1072
0.1057 0.1044 0.1060 0.1013 0.0984 0.1064 0.1057 0.0397 0.0975 0.1036 0.1071
0.1058 0.1044 0.1061 0.1013 0.0984 0.1064 0.1058 0.1066 0.0548 0.1036 0.1072
0.1058 0.1044 0.1061 0.1013 0.0984 0.1064 0.1058 0.1066 0.0976 0.0509 0.1072
Columns 12 through 20
0.1058 0.1057 0.1058 0.1058 0.1057 0.1057 0.1057 0.1058 0.1058
0.0489 0.1043 0.1044 0.1044 0.1044 0.1044 0.1044 0.1044 0.1044
0.1061 0.0329 0.1061 0.1061 0.1060 0.1060 0.1060 0.1061 0.1061
0.1013 0.1012 0.0552 0.1013 0.1012 0.1013 0.1013 0.1013 0.1013
0.0984 0.0984 0.0985 0.0554 0.0984 0.0984 0.0984 0.0984 0.0984
0.1064 0.1064 0.1065 0.1064 0.0362 0.1064 0.1064 0.1064 0.1064
0.1058 0.1057 0.1058 0.1058 0.1057 0.0450 0.1057 0.1058 0.1058
0.1066 0.1066 0.1066 0.1066 0.1066 0.1066 0.0397 0.1066 0.1066
0.0976 0.0975 0.0976 0.0976 0.0975 0.0975 0.0975 0.0548 0.0976
0.1036 0.1035 0.1036 0.1036 0.1036 0.1036 0.1036 0.1036 0.0509
0.1072 0.1071 0.1073 0.1073 0.1071 0.1072 0.1071 0.1072 0.1072
0.2281 0.1071 0.1073 0.1073 0.1071 0.1072 0.1072 0.1073 0.1072
0.1071 0.2280 0.1072 0.1072 0.1070 0.1071 0.1071 0.1072 0.1071
0.1073 0.1072 0.2282 0.1073 0.1072 0.1073 0.1072 0.1073 0.1073
0.1073 0.1072 0.1073 0.2282 0.1072 0.1073 0.1072 0.1073 0.1073
0.1071 0.1070 0.1072 0.1072 0.2280 0.1071 0.1071 0.1072 0.1072
0.1072 0.1071 0.1073 0.1073 0.1071 0.2280 0.1071 0.1072 0.1072
0.1072 0.1071 0.1072 0.1072 0.1071 0.1071 0.2280 0.1072 0.1072
0.1073 0.1072 0.1073 0.1073 0.1072 0.1072 0.1072 0.2282 0.1073
0.1072 0.1071 0.1073 0.1073 0.1072 0.1072 0.1072 0.1073 0.2281
eig(summation) is positive even then matlab says
Error using mvnrnd (line 110)
'summation' must be a symmetric positive semi-definite matrix.
  2 Kommentare
David Goodmanson
David Goodmanson am 29 Jul. 2019
Bearbeitet: David Goodmanson am 30 Jul. 2019
Hi vikas,
this may be some kind of error due to cutting and pasting. However:
>> summation(11,1)
ans = 450000
>> summation(1,11)
ans = 611000
so the matrix is not symmetric.
vikas Kumar
vikas Kumar am 30 Jul. 2019
Thanks David Goodmanson, for replying. Although i have used nearestSPD(summation) function that has solved my problem.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Steven Lord
Steven Lord am 29 Jul. 2019
If that difference in summation(11, 1) and summation(1, 11) David Goodmanson noted is just a copy-and-paste error, it would still be worth a quick check to see if your matrix issymmetric. Your matrix may be close to symmetric, but this is neither horseshoes nor hand grenades so "close" doesn't count.
If it isn't symmetric, depending on how "far away from symmetric" it is replacing it with the average of itself and its transpose may be acceptable. To check this, see what the maximum difference is.
maximumDifference = max(summation-summation.', 'all') % R2018b or later
D = summation-summation.';
maximumDifference = max(D(:)) % R2018a or earlier
As I noted in the comment, max only accepts the 'all' option in release R2018b and later releases. If that difference is "small" (for your definition of "small") use this matrix instead.
symmetricSummation = (summation+summation.')./2;
  1 Kommentar
David Goodmanson
David Goodmanson am 29 Jul. 2019
Bearbeitet: David Goodmanson am 30 Jul. 2019
I had checked it, using
[a b] = find((m-m')~=0)
and the two elements noted before were the only ones that did not meet exact equality. But since the matrix was copied into the window using a four-decimal-place format, there is always the significant possibility that some matrix elements disagree in decimal places further on down the line. Strict equality in floating point is not always easy to achieve.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by