How to solve minimization problem for matrix system
Show older comments
I have a system of matrices and I need to solve minimization problem.
Please see the matrix in the attached Word document.
Also attached is my code
The whole code is to calculate the values for the matrix system. This part I already did.
The matrix system is this C1*A1*x1 + C2*A2*x2 = B
C1 and C2 are scalar constants.
A1 and A2 are matrices of size (3 by 4).
x1 and x2 are matrices of size (4 by 1).
B is a matrix of size (3 by 1).
All the elements are known values calculated in the code, except elements of [x2] and the last element of matrix B. "B(3,1)"
Matrix [x2]: The number of elements of matrix [x2] are four but actually they are only three variables because x2(2,1) and x2(3,1) are the same variable 'delta_a'. These variables in the code are ('delta_a', 'delta_c', 'delta_t') defined in line 178. The values of the elements of matrix x2 can be constrained in a range of integers from (-5) to (+5).
The required minimization is for the variable (Di) in matrix B in line 183.
Please see attached matrix and code.
Musab
Accepted Answer
More Answers (1)
John D'Errico
on 18 Jan 2018
0 votes
A bit confusing to say the least. First, you tell us that x2 is a MATRIX of size 4x1. Then you talk about element x(2,2)? I can only assume you meant to write x2 there, because there is no variable x. You are also a bit sloppy, in that in some places you understand that B will be a column vector, thus of size 3x1, but in other places, you talk about B(1,3).
Anyway, it seems that x2 has 3 unknowns in it. They can take on only integer values -5 to 5. Just generate all possible combinations of those levels (use ndgrid to do so) and test the result. This will require only a matrix multiplication. WTP?
Essentially, you will create an array for x2 that is 4x1331. That will result in 1331 possible results. Pick the one that makes you happy.
Note that you say nothing about the requirement that elements B(1) and B(2) must match? So are these exact equality constraints? What if no solution exists? This is possible since x2 is constrained to live on a restricted set of integers.
Categories
Find more on Linear Least Squares in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!