Convert the symbolic output from "solve(X)" into an actual number?

29 ビュー (過去 30 日間)
mark
mark 2013 年 11 月 28 日
コメント済み: bisril khasani 2023 年 2 月 3 日
I have a relatively simple script to compute the symbolic momentum transfer of two masses:
if true
syms Ve Vf
B=solve(Meff*Ue + Mfr*Uf==Meff*Ve + Mfr*Vf,...
Meff*Ue^2 + Mfr*Uf^2==Meff*Ve^2 + Mfr*Vf^2);
B.Ve
B.Vf
end
However, the output is of the form:
if true
45979398170439294812429051595678^(1/2)/16888498602639360 + 1130135171001427/5629499534213120
end
which is simply equal to
if true
ans =
0.6023
end
How do I convert the output into this simple numerical value?
Cheers.
  1 件のコメント
bisril khasani
bisril khasani 2023 年 2 月 3 日
sorry may I ask?
if i have got the solver function result on matlab. but the result of the solve is in the form of a text equation. How do I convert the Text Equation result solve into a value?
thanks
example :
a_c = -0.140126955137392
b_c = -1.359255259600307
c_c = -1.256085685806453
m_b1 = 2.553927497513322
c_b1 = 9.797462866308580
syms x
eqn = a_c*(log10(x)).^2+b_c*(log10(x))+c_c== m_b1*(log10(x))+c_b1
s = solve(eqn,x)
x_1 = s(1,1)
x_2 = s(2,1)

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

採用された回答

Walter Roberson
Walter Roberson 2013 年 11 月 29 日

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by