Multivariate symbolic math function from input sym vector

バージョン 1.0.1 (2.82 KB) 作成者: Imran Khan
Outputs multidimensional and multivariate symbolic function from input symbolic vector
ダウンロード: 0
更新 2024/6/12

ライセンスの表示

Currently, MATLAB's symbolic toolbox does not allow functions to be defined in the following way:
N = 3;
syms my_var [N 1];
syms my_func(my_var);
At present, doing this deletes the my_var variable and overwrites it as a scalar. The only way to define multivariate functions is explicitly, which requires knowing the input vector dimensionality beforehand:
syms my_func(my_var1,my_var2,my_var3);
my_var = [my_var1;my_var2;my_var3];
This function allows my_func to be defined through its input vector my_var:
N = 3;
syms my_var [N 1];
makeMultivariateSymFunctionFromInputVector(my_var,"my_func");
------
It also allows creation of multidimensional symbolic functions by just specifying the function_dimension, e.g. instead of:
syms my_func1(my_var1,my_var2,my_var3);
syms my_func2(my_var1,my_var2,my_var3);
syms my_func3(my_var1,my_var2,my_var3);
syms my_func4(my_var1,my_var2,my_var3);
syms my_func5(my_var1,my_var2,my_var3);
my_var = [my_var1;my_var2;my_var3];
my_func = [my_func1;my_func2;my_func3;my_func4;my_func5];
The function can be called:
N = 3;
syms my_var [N 1];
my_func = makeMultivariateSymFunctionFromInputVector(my_var,"my_func",5);
------
See the example m-file for more usage examples.

引用

Imran Khan (2024). Multivariate symbolic math function from input sym vector (https://www.mathworks.com/matlabcentral/fileexchange/167966-multivariate-symbolic-math-function-from-input-sym-vector), MATLAB Central File Exchange. に取得済み.

MATLAB リリースの互換性
作成: R2022a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
タグ タグを追加

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート
1.0.1

Fixed description.

1.0.0