How to convert an expression to a function with lossless precision?
显示 更早的评论
I use matlabFunction to convert an expression to an anonymous function, but the convertion of matlabFunction has a loss of precision. Is there a lossless conversion method? If not, is there any conversion method to improve accuracy?

4 个评论
Ameer Hamza
2020-9-27
Can you give an example of expression, sol1, and sol2? It will be easier if you can share the code in the text format instead of attaching it as an image.
Chenguang Yan
2020-9-27
Chenguang Yan
2020-9-27
Ameer Hamza
2020-9-27
As Walter mentioned in his answer, you will lose precision once you convert from symbolic maths to finite-precision. To get exact results, you must stick to variable precision or symbolic mathematics.
采纳的回答
更多回答(2 个)
madhan ravi
2020-9-27
vpa(f_func(sym(sol1), sym(sol2)))
3 个评论
Chenguang Yan
2020-9-27
madhan ravi
2020-9-27
When you use matlabFunction() , it converts it into double precision, why not use subs()?
Chenguang Yan
2020-9-27
类别
在 帮助中心 和 File Exchange 中查找有关 Linear Algebra 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!