How to solve nonlinear equation with unknown variables?

조회 수: 3 (최근 30일)
Shipu HAN
Shipu HAN 2019년 12월 6일
댓글: Shipu HAN 2019년 12월 6일
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?

채택된 답변

Walter Roberson
Walter Roberson 2019년 12월 6일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by