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 CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by