How to convert an expression to a function with lossless precision?
Ältere Kommentare anzeigen
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 Kommentare
Ameer Hamza
am 27 Sep. 2020
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
am 27 Sep. 2020
Chenguang Yan
am 27 Sep. 2020
Ameer Hamza
am 27 Sep. 2020
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.
Akzeptierte Antwort
Weitere Antworten (2)
madhan ravi
am 27 Sep. 2020
vpa(f_func(sym(sol1), sym(sol2)))
3 Kommentare
Chenguang Yan
am 27 Sep. 2020
madhan ravi
am 27 Sep. 2020
When you use matlabFunction() , it converts it into double precision, why not use subs()?
Chenguang Yan
am 27 Sep. 2020
Chenguang Yan
am 27 Sep. 2020
Bearbeitet: Chenguang Yan
am 27 Sep. 2020
0 Stimmen
Kategorien
Mehr zu Linear Algebra finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!