,v1Trying to solve a linear equation matrix with a log of X1-X5 in the matrix. Not sure how to use the log value in simulate to get correct result.

2 vues (au cours des 30 derniers jours)
  2 commentaires
Torsten
Torsten le 1 Mai 2023
Modifié(e) : Torsten le 1 Mai 2023
6 equations for 11 unknows ? Then 11 - 6 = 5 of the unknowns can usually be chosen arbitrarily. Is it this what you want ?
Greg Zozuls
Greg Zozuls le 1 Mai 2023
No that's not what I want. I need to figure out how to use the log function to all unknowns using the lsqminnorm function

Connectez-vous pour commenter.

Réponses (2)

Matt J
Matt J le 1 Mai 2023
Modifié(e) : Matt J le 1 Mai 2023
Make the change of variables z(i)=log(X(i)). Then use lsqminnorm to solve the linear equations in v(i) and z(i). You can then extract solutions for X(i) by inverting the change of variables X(i)=exp(Z(i)).

Torsten
Torsten le 1 Mai 2023
Modifié(e) : Torsten le 1 Mai 2023
A = [1 0 0 0 0 0.05 0 0 0 0 0;-1 1 0 0 0 0 0.05 0 0 0 0;0 -1 1 0 0 0 0 0.05 0 0 0;0 0 -1 1 0 0 0 0 0.05 0 0;0 0 0 -1 1 0 0 0 0 0.05 0;0 0 0 0 -1 0 0 0 0 0 0.05];
B = [2.903;0; 0; 0; 0; -1.398];
sol = lsqminnorm(A,B);
norm(sol)
ans = 13.2118
A*sol-B
ans = 6×1
1.0e-14 * 0.0888 0.0222 0.0611 -0.1277 -0.0999 -0.0666
sol(1:5) = exp(sol(1:5));
X = sol(1:5)
X = 5×1
13.9824 10.7962 8.3858 6.5482 5.1374
nu = sol(6:11)
nu = 6×1
5.3040 5.1721 5.0532 4.9468 4.8529 4.7710

Community Treasure Hunt

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

Start Hunting!

Translated by