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 日
Chenguang Yan
2020 年 9 月 27 日
編集済み: Chenguang Yan
2020 年 9 月 27 日
0 投票
カテゴリ
ヘルプ センター および File Exchange で Conversion Between Symbolic and Numeric についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!