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.
  1 件のコメント
Shipu HAN
Shipu HAN 2019 年 12 月 6 日
Thanks a lot, that works.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAssumptions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by