How to convert anonymous function to symbolic function in MATLAB?

Let's say I have an anonymous function f = @(x) x^2 , and I want to convert it to a symbolic function. Is there a built-in command for this?

+6
source share
1 answer

You can just pass it to SYM:

 f = @(x) x^2; g = sym(f) 

But then most symbolic functions do this automatically when they receive a function handle ( subs , int , etc.)

+11
source

Source: https://habr.com/ru/post/919644/


All Articles