Solve an equation of 3 unknowns

4 vues (au cours des 30 derniers jours)
Stergios Verros
Stergios Verros le 23 Août 2017
Commenté : Torsten le 25 Août 2017
Dear all,
I have the following equation:
z = k2/2 * (k1 / k3)
w = sqrt(k1 * k3)
eqn1 = 1/(-z * w) * log(sqrt(1 - z^2)) + log(2)/(z * w) * A - t
with A and t being column vectors with same length.
How is it possible to calculate k1, k2, k3?
Thank you!

Réponse acceptée

Torsten
Torsten le 24 Août 2017
Forget about z,w,k1,k2,k3.
You have a regression equation of the form
t = c1 + c2*A
and you want to fit c1 and c2.
Try
X=[ones(length(t),1) A];
c=X\t;
c(1)
c(2)
Now, from c(1) and c(2) you can calculate z and w by solving
1/(-z*w)*log(sqrt(1-z^2)) = c(1)
log(2)/(z*w)=c(2)
Best wishes
Torsten.
  2 commentaires
Stergios Verros
Stergios Verros le 24 Août 2017
Hi Torsten,
That is a good idea but can I calculate the k1, k2, k3 values knowing only z and w?
Also, I am not familiar with the equation solving so I did this:
syms z w
eqn1 = 1/(-z*w)*log(sqrt(1-z^2)) - c(1)
eqn2 = log(2)/(z*w) - c(2)
solx = solve(eqn1,eqn2,z,w)
Thank you a lot.
Stergios
Torsten
Torsten le 25 Août 2017
Calculation with pencil and paper gives
z = sqrt(1-2^(-2*c(1)/c(2)))
w= log(2)/c2 * 1/sqrt(1-2^(-2*c(1)/c(2)))
Note that the approach I suggested is only valid if c1 and c2 coming out of the linear regression have the same sign. If not, you will have to constrain the c1 and c2 to have the same sign.
Your equations for k1, k2 and k3 depending on z and w don't determine k1, k2 and k3 uniquly because you have 2 equations in 3 unknowns, thus an overdetermined system.
If you give an arbitrary value to k1, e.g., you arrive at
k2 = 2*z*w^2/k1^2
k3 = w^2/k1
Best wishes
Torsten.

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 24 Août 2017
There is no solution.
syms A t
syms k1 k2 k3
syms z w eqn1
E = [z == k2/2 * (k1 / k3), w == sqrt(k1 * k3), eqn1 == 1/(-z * w) * log(sqrt(1 - z^2)) + log(2)/(z * w) * A - t]
solve(E,[k1,k2,k3])
ans =
struct with fields:
k1: [0×1 sym]
k2: [0×1 sym]
k3: [0×1 sym]
Now, here I tried A and t as scalars rather than as column vectors. If you treat them as non-scalar vectors then you increase the number of equations but you do not increase the number of distinct left-hand sides, so you would just end up over-constraining the values.
Perhaps, those, your lines are intended to be procedural. This leads to the question of whether you have a number of different known values for eqn1, or if instead each right hand side is intended to equal 0. If it is intended to equal 0, then is that a strict requirement, or are you looking for optimal k1, k2, k3 ? You would probably need to use curvefitting techniques.
  1 commentaire
Stergios Verros
Stergios Verros le 24 Août 2017
Thank you for your answer.
Replying to your question, I have a number of different known values which are on the column vectors of A and t. Basicaly, the equation look like this:
1/(-z * w) * log(sqrt(1 - z^2)) + log(2)/(z * w) * A = t
I do not know if moving t on the left side was the right thing to do but I was hoping to find the optimal values of k1, k2, k3.
How can I use the curving fit techniques?
Thanks

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by