Convert the symbolic output from "solve(X)" into an actual number?
28 次查看(过去 30 天)
显示 更早的评论
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
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)
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!