How to solve nonlinear equation with unknown variables?

3 vues (au cours des 30 derniers jours)
Shipu HAN
Shipu HAN le 6 Déc 2019
Commenté : Shipu HAN le 6 Déc 2019
I'm trying to solve the following equation using matlab 'syms'.
equation.png
my code is:
syms x
solution = solve (W_c*(1 + (5/8)*(0.85*((2*x/delta_c - 1)^2 - 1) + 0.3*(2*x/delta_c - 1)^2*log(2*x/delta_c - 1))) - (1/2)*m*v_in^2 == 0, x);
delta_m = solution;
and my answer is:
delta_m =
(6284008282358037*exp(lambertw(0, (262048699488897879269*exp(17/3))/25743973330415775)/2 - 17/6))/2417851639229258349412352 + 6284008282358037/2417851639229258349412352
(6284008282358037*exp(lambertw(-1, (262048699488897879269*exp(17/3))/25743973330415775)/2 - 17/6))/2417851639229258349412352 + 6284008282358037/2417851639229258349412352
(6284008282358037*exp(lambertw(1, (262048699488897879269*exp(17/3))/25743973330415775)/2 - 17/6))/2417851639229258349412352 + 6284008282358037/2417851639229258349412352
I don't know why it gives me such an answer, cause I suppose it should give me a real number.
I'm not sure if I'm using the correct code, can someone please help me with that?

Réponse acceptée

Walter Roberson
Walter Roberson le 6 Déc 2019
No, it should not give you a real number. You did not tell MATLAB that x is restricted to reals, so it is proper that solve() returns all of the mathematically correct solutions it can find.
You can use
syms x real
This is not guaranteed to only return reals, so you might need to proceed to
x(imag(x) ~= 0) = [] ;
I also suspect that you will want to vpa(x) to see a numeric approximation to the exact solution that is returned.
Remember that if you do not want infinitely precise closed form solutions then solve() is probably the wrong function to call and vpasolve() is more likely to be what you want.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by