optimally selecting elements in matrix to satisfy the system of equations

2 vues (au cours des 30 derniers jours)
sarath yadav
sarath yadav le 27 Juil 2018
Modifié(e) : Aquatris le 3 Août 2018
Hi I am sarath, I am working on system of equations that have unknown matrices, which needs to be solved using optimization.
I have 3 different equations which are function of matrices (A,B,C)
A=[0 1 0 0; 0 0 1 0; 0 0 0 1; -a1 -a2 -a3 -a4]
B=[b1;b2;b3;b4]
C=[c1 c2 c3 c4]
I know the right hand side scalar values of all the three equations. I need to solve for this A, B, C matrices such that, those matrices should satisfy the right hand side scalar values.
Requesting for suggestions.
  2 commentaires
Amal George M
Amal George M le 2 Août 2018
Modifié(e) : Amal George M le 2 Août 2018
Hi Sarath,
Can you provide details on how these matrices are related or the equation which needs solving?
sarath yadav
sarath yadav le 2 Août 2018
Modifié(e) : per isakson le 2 Août 2018
Hi amal,
Thanks for your response. Here are the equations below.
equation.1:
2.12=C*(exp(0.9*A)*(exp(0.1*A)*(inv(I-exp(4.14*A)*(inv(A)*((exp(4.14*A)-2*exp(4.04*A)+2*exp(1.97*A)-I)*B))))+inv(A)*(exp(0.1*A)-I)*1*B)-(inv(A)*(exp(0.9*A)-I)*B))
equation.2:
-0.1=C*(inv(A)*(inv(I-exp(4.14*A))*(exp(4.14*A)*(I-exp(0.1*A)))-(exp(0.1*A)-I))*1*B)
equation.3:
0.1=C*(inv(A)*(inv(I-exp(4.14*A))*(exp(4.24*A)-2*exp(4.14*A)+2*exp(2.07*A)-exp(0.1*A))+(exp(0.1*A)-I))*1*B)
Above are the three equations. All the three equations are the functions of A, B and C.
I need to optimally get A, B and C such that, it satisfies all the three equations.
Structure of A, B and C are as follows:
A=[0 1 0 0; 0 0 1 0; 0 0 0 1; -a1 -a2 -a3 -a4]
B=[b1;b2;b3;b4]
C=[c1 c2 c3 c4]

Connectez-vous pour commenter.

Réponses (1)

Aquatris
Aquatris le 3 Août 2018
Modifié(e) : Aquatris le 3 Août 2018
First of all, in Matlab you need to use expm() function for matrix exponentials.
Secondly, your 1st equation is wrong. the right hand side gives 4x1 row vector instead of scalar.
Other than that you can create a function like (i commented out 1st equation since it has errors, but you can look into what the error is in your equation derivation and fix it);
function err = deltah(x)
a1 =x(1);
a2 =x(2);
a3 =x(3);
a4 =x(4);
b1 =x(5);
b2 =x(6);
b3 =x(7);
b4 =x(8);
c1 =x(9);
c2 =x(10);
c3 =x(11);
c4=x(12);
A=[0 1 0 0; 0 0 1 0; 0 0 0 1; -a1 -a2 -a3 -a4];
B=[b1;b2;b3;b4];
C=[c1 c2 c3 c4];
I = eye(4);
% eq(1) = 2.12-C*(expm(0.9*A)*(expm(0.1*A)*(inv(I-expm(4.14*A)*(inv(A)* ...
% ((expm(4.14*A)-2*expm(4.04*A)+2*expm(1.97*A)-I)*B))))+inv(A)*(expm(0.1*A)-I)*1*B)- ...
% (inv(A)*(expm(0.9*A)-I)*B));
eq(2) = -0.1-C*(inv(A)*(inv(I-expm(4.14*A))*(expm(4.14*A)*(I-expm(0.1*A)))- ...
(expm(0.1*A)-I))*1*B);
eq(3) = 0.1-C*(inv(A)*(inv(I-expm(4.14*A))*(expm(4.24*A)-2*expm(4.14*A)+2*expm(2.07*A)- ...
expm(0.1*A))+(expm(0.1*A)-I))*1*B);
err = norm(eq);
end
Than, in the command window, you can use fminunc or any other optimization functions to have the solution and assign them to the correct variables;
x = fminunc(@deltah,rand(12,1));
a1 =x(1);
a2 =x(2);
a3 =x(3);
a4 =x(4);
b1 =x(5);
b2 =x(6);
b3 =x(7);
b4 =x(8);
c1 =x(9);
c2 =x(10);
c3 =x(11);
c4=x(12);
With the 1st equation omitted, the value of x I got is;
x =
0.3449
-0.0326
0.3539
1.0273
0.2967
0.7542
-0.5809
-0.4496
-1.0049
0.2925
-0.9052
0.8451
and using these, the values of right hand side of the 2nd equation was exactly -0.1000 and the 3rd equation was exactly 0.1000.

Produits


Version

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by