Convert a symbolic object X with variables a1,a2,a3,...,aN to a function handle hX. The handle hX can evaluated by hX(a), where "a" is an array of variables a=[a1,a2,a3,...,aN]. A function handle hX is an anonymous function (not stored in a program file).
There are two distinct variations in the usage of SYM2FHANDLE:
1. Symbolic object X has N variables a1,a2,a3,...,aN.
For an object X(a1,a2,a3,...,aN), SYM2FHANDLE converts X to hX(a), where the input a is an array with the length of N.
2. Symbolic object X has N variables and a domain variable.
For an object e.g. X(a1,a2,a3,...,aN,w), SYM2FHANDLE converts X to hX(a,w). Here, w is a "domain". Domain can be e.g. time, frequency or complex frequency variable (s or z).
SYM2FHANDLE outputs a function handle and an element-wise version of the function handle. The latter can be used to evaluate domain as an array. A good example would be generating a frequency response of a transfer function.
The class of the array and domain can be anything that MATLAB can evaluate. For instance, if the domain is an LTI object, the variable array cannot be symbolic.
The possibilities of SYM2FHANDLE are endless, but here's my favourite: For an equation (or a system of equations) converted to a handle hX, you can use the handle as a target function to optimization toolbox function such as FSOLVE or LSQNONLIN. The outcome is the optimized values of a1,a2,a3,...,aN.
引用格式
Marko Neitola (2024). sym2fhandle (https://www.mathworks.com/matlabcentral/fileexchange/131219-sym2fhandle), MATLAB Central File Exchange. 检索来源 .
MATLAB 版本兼容性
创建方式
R2023a
与 R14SP1 及更高版本兼容
平台兼容性
Windows macOS Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0 |