Effacer les filtres
Effacer les filtres

Two equivalent codes getting different answer

2 vues (au cours des 30 derniers jours)
khushi
khushi le 14 Juil 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 commentaire
Alan Weiss
Alan Weiss le 16 Juil 2017
Please mark your coed using the {} Code button so that we can read it.
Alan Weiss
MATLAB mathematical toolbox documentation

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by