how to find unknown within equation having unknown
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a equation which includes 2 matrix and 1 unknown I want to calculate the unknown for each row and save the results as another matrix for each term my equation is R/X=( 0.8*log(L*X/10e-06)+33 )
R is 132x1 matrix (known)
L is 132x1 matrix (known)
I want to find X matrix
0 Commenti
Risposte (2)
Star Strider
il 22 Dic 2021
I have no idea if this actually has a robust (and mathematically correct) solution.
It is always appropriate to experiment, so I am doing that here —
RLX_fcn = @(X,R,L) R./X - ( 0.8*log(L.*X/10e-06)+33 )
R = randn(10,1);
L = randn(10,1);
X0 = rand(size(R))
[Xv,fv] = fsolve(@(X)RLX_fcn(X,R,L), X0)
Experiment further with the correct vectors.
.
1 Commento
John D'Errico
il 22 Dic 2021
Modificato: John D'Errico
il 22 Dic 2021
Actually, no that is not correct, and it has an analytical solution, in terms of the wrightOmega function. It is sort of a cousin to the Lambert W, and probably about as well known.
John D'Errico
il 22 Dic 2021
Modificato: John D'Errico
il 22 Dic 2021
R and L are known, with X being an unknown.
syms X L R
Xsol = solve(R/X==( 0.8*log(L*X/10e-06)+33),X)
The script w there is the wrightOmega function in MATLAB. Most people don't seem to know it even exists, but it does, as a special function, essentially to solve this exact class of problem..
help wrightOmega
So now you can form the solution simply enough, as...
Xfun = matlabFunction(Xsol)
So Xfun is a function of two variables, L and R. We can use this as follows:
Xfun(1,3)
If L and R are vectors, it will still work.
Xfun([1 2 3],[4 5 6])
0 Commenti
Vedere anche
Categorie
Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!