如何在 MATLAB 中将匿名函数转换为符号函数? [英] How do I convert an anonymous function to a symbolic function in MATLAB?

查看:57
本文介绍了如何在 MATLAB 中将匿名函数转换为符号函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个匿名函数 f = @(x) x^2 并且我想将其转换为符号函数.是否有内置命令?

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?

推荐答案

你可以把它传递给 SYM:

You could just pass it to SYM:

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

但是大多数符号函数在收到函数句柄(subsint 等...)时会自动执行此操作

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

这篇关于如何在 MATLAB 中将匿名函数转换为符号函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆