Solve an equation of 3 unknowns
4 views (last 30 days)
Show older comments
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!
0 Comments
Accepted Answer
Torsten
on 24 Aug 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 Comments
Torsten
on 25 Aug 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.
More Answers (1)
Walter Roberson
on 24 Aug 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.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!