Azzera filtri
Azzera filtri

Two equivalent codes getting different answer

2 visualizzazioni (ultimi 30 giorni)
khushi
khushi il 14 Lug 2017
Modificato: Walter Roberson il 16 Lug 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 Commento
Alan Weiss
Alan Weiss il 16 Lug 2017
Please mark your coed using the {} Code button so that we can read it.
Alan Weiss
MATLAB mathematical toolbox documentation

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by