sym2fun

版本 1.0.0.0 (3.9 KB) 作者: Siamak
sym2fun converts symbolic expressions to anonymous functions using vector symbolic arguments.
78.0 次下载
更新时间 2017/11/25

查看许可证

sym2fun converts symbolic expressions to anonymous functions based on vector representations of the symbolic arguments.
syntax
f = sym2fun(fsym, vars, symVec1, repVec1, ..., symVecN, repVecN)

Description
f = sym2fun( __ ) converts the symbolic statement fsym to an anonymous function handle f with the input arguments listed in vars. The input pairs symVec and repVec contain the symbolic vectors and the corresponding numerical vector representations. The data types for the input arguments are:
f: an anonymous function handle
fsym: an NxM symbolic matrix
vars: a cell array that contains the input names for f (that is f = f(vars{1}, vars{2}, ..., vars{p})
symVec: A vector of symbolic arguments
repVec: A cell array that contains the replacement names for each of the entries in symVec.

Example
>> x = sym('x%d',[3,1],'real');
>> y = sym('y%d',[3,1],'real');
>> p = [2*cos(x(1)) + 7*y(1)^2; sin(x(2)+y(2))];
>> J = jacobian(p,[x;y]) + randi([-10 10],2,4);
>> f = sym2fun(J, {'x','y'}, x, {'x(1)','x(2)'}, y, {'y(1)','y(2)'});

引用格式

Siamak (2024). sym2fun (https://www.mathworks.com/matlabcentral/fileexchange/65186-sym2fun), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2017a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Formula Manipulation and Simplification 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0