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

27 views (last 30 days)
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 Comment
bisril khasani
bisril khasani on 3 Feb 2023
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)

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 29 Nov 2013
double(B.Ve)

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!