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

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

问题描述

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

解决方案

您可以将它传递给SYM:

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

但是当大多数符号函数自动执行时接收一个函数句柄( subs int ,等等...)


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

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

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