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

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 comentario

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)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 28 de Nov. de 2013

Comentada:

el 3 de Feb. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by