How to use matlab to find the optimized matrix with regarding to minimization of Frobenius norm

3 vues (au cours des 30 derniers jours)
I'm trying to solve a minimization problem whose purpose is to optimize a matrix whose square is close to another given matrix. but I have some problems to execute it by using matlab. The problem is illustrated as follows:
First question is how should I define the such an undetermined matrix when using optimization function in matlab;
Second question is if there is a specified toolbox to solve this problem?
  2 commentaires
li
li le 13 Avr 2018
Modifié(e) : Walter Roberson le 13 Avr 2018
Yes. The answer provided by Torsten is very good. However, I found the answer provided by Johan Löfberg is simple (See the answer here https://math.stackexchange.com/a/1672198/171352). The code was used in the paper A Weightedly Uniform Detectability for Sensor Networks

Connectez-vous pour commenter.

Réponse acceptée

Torsten
Torsten le 25 Fév 2016
Modifié(e) : Torsten le 25 Fév 2016
function main
G=zeros(4,4);
G(1,1)=0.48;
G(1,2)=0.24;
G(1,3)=0.16;
G(1,4)=0.12;
G(2,:)=G(1,:);
G(3,:)=G(1,:);
G(4,:)=G(1,:);
Aeq=zeros(4,12);
Aeq(1,1)=1.0;
Aeq(1,2)=1.0;
Aeq(1,3)=1.0;
Aeq(2,4)=1.0;
Aeq(2,5)=1.0;
Aeq(2,6)=1.0;
Aeq(3,7)=1.0;
Aeq(3,8)=1.0;
Aeq(3,9)=1.0;
Aeq(4,10)=1.0;
Aeq(4,11)=1.0;
Aeq(4,12)=1.0;
beq=ones(4,1);
lb=zeros(1,12);
ub=ones(1,12);
x0=ones(1,12)/3;
x = fmincon(@(x)obj(x,G),x0,[],[],Aeq,beq,lb,ub);
function val=obj(x,G)
Q(1,1)=x(1);
Q(1,2)=x(2);
Q(1,3)=0.0;
Q(1,4)=x(3);
Q(2,1)=x(4);
Q(2,2)=x(5);
Q(2,3)=x(6);
Q(2,4)=0.0;
Q(3,1)=0.0;
Q(3,2)=x(7);
Q(3,3)=x(8);
Q(3,4)=x(9);
Q(4,1)=x(10);
Q(4,2)=0.0;
Q(4,3)=x(11);
Q(4,4)=x(12);
val=sum(reshape((Q^2-G).^2,16,1));
end
Best wishes
Torsten.
  11 commentaires
CA Hau
CA Hau le 2 Mar 2017
May I know if there are two constraints for the first rows (eg. q11+q12+q14 = 1 & q11-q12-q14 = 0.01) how should I modify the constraint? Thank you in advance for any enlightenment
Walter Roberson
Walter Roberson le 9 Jan 2018
q11+q12+q14 = 1 & q11-q12-q14 = 0.01
would be
Aeq(1,1) = 1;
Aeq(1,2) = 1;
Aeq(1,3) = 1;
b(1,1) = 1;
Aeq(2,1) = 1;
Aeq(2,2) = -1;
Aeq(2,3) = -1;
b(2,1) = 0.01;
But remember that 0.01 does not have an exact representation in binary floating point, so the closest you can get to that second constraint is q11-q12-q14 = 0.01000000000000000020816681711721685132943093776702880859375

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by