How to solve for matrix in Matlab?

386 views Asked by At

How can I solve eq1, where eq2 and eq3 and eq4 eq5 in the least squares sense in matlab?

So I'd like to have the minimizing eq6 as output.

1

There are 1 answers

7
jub0bs On BEST ANSWER

Rewrite the quantity to minimise as

||Xa - b||^2

= (definition of the Frobenius norm)

Tr{(Xa - b) (Xa - b)'}

= (expand matrix-product expression)

Tr{Xaa'X' - ba'X' - Xab' + bb'}

= (linearity of the trace operator)

Tr{Xaa'X'} - Tr{ba'X'} - Tr{Xab'} + Tr{bb'}

= (trace of transpose of a matrix = trace of the matrix)

Tr{Xaa'X'} - 2 Tr{ba'X'} + Tr{bb'}

where ' denotes the transpose operator (because all matrices involved are real, transpose and conjugate transpose are the same). Now, if you refer to section 2.5 of the Matrix Cookbook, you'll find that

  • the derivative of Tr{Xaa'X'} is 2Xaa' (see equation 111),
  • the derivative of Tr{ba'X'} is ba' (see equation 104),
  • the derivative of Tr{bb'} is 0 (because this expression doesn't depend on X).

(Differentiation is performed with respect to matrix X).

Therefore, the matrix that minimises the quantity of interest satisfies

2Xaa' = 2ba'
Xaa' = ba'

Therefore, you can use MATLAB's matrix right-division operator, /, to compute X:

X = b * a' / (a * a');