Say I have a anonymous function f = @(x) x^2
and I want to convert this to a symbolic function. Is there a built in command for that?
You could just pass it to SYM:
f = @(x) x^2;
g = sym(f)
But then most of the symbolic functions do that automatically when they receive a function handle (subs
, int
, etc...)
来源:https://stackoverflow.com/questions/11322295/how-do-i-convert-an-anonymous-function-to-a-symbolic-function-in-matlab