How do I convert an anonymous function to a symbolic function in MATLAB?
Asked Answered
S

1

8

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?

Stertorous answered 4/7, 2012 at 4:8 Comment(1)
func2str?Shot
I
11

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...)

Import answered 4/7, 2012 at 7:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.