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에서 Assumptions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!