Filter löschen
Filter löschen

Two equivalent codes getting different answer

2 Ansichten (letzte 30 Tage)
khushi
khushi am 14 Jul. 2017
Bearbeitet: Walter Roberson am 16 Jul. 2017
Code 1:
AD=[1 8 4;5 6 3;2 7 6];
dd=[1 6 7;3 6 8;2 6 5];
cvx_begin
variables QM(3,3)
maximize log_det(eye(3)+dd*QM)
subject to
norm(QM*AD,'fro')<=10;
cvx_end
Code 2:
AD=[1 8 4;5 6 3;2 7 6];
dd=[1 6 7;3 6 8;2 6 5];
[RU,RS,RV]=svd(inv(AD)*dd);
cvx_begin
variables QM(3,3)
maximize log_det(eye(3)+RS*QM)
subject to
norm(QM,'fro')<=10;
cvx_end
Code 2 is obtained from Code 1 by change of variables so I believe that these two codes are equivalent. However, I am getting different answers i.e. the maximum value of objective function. Is there something wrong with the change of variables?
Following are the change in variables
det(I+dd QM)=det(ADAD^(-1)+dd QM AD AD^(-1) )
=det(AD(I+AD^(-1) dd QM AD)AD^(-1))
det(I+dd QM)=det(I+AD^(-1) dd QM AD)=det(I+UΣV^T QM AD)=det(I+ΣV^T QM AD U)=det(I+ΣR)
norm(QM AD)=norm(VV^T QM AD U U^T )=norm(V R U^T )=trace(V R U^T U R^T V^T )=trace(R R^T)
  1 Kommentar
Alan Weiss
Alan Weiss am 16 Jul. 2017
Please mark your coed using the {} Code button so that we can read it.
Alan Weiss
MATLAB mathematical toolbox documentation

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by