Multivariate symbolic math function from input sym vector

Version 1.0.1 (2,82 ko) par Imran Khan
Outputs multidimensional and multivariate symbolic function from input symbolic vector
1 téléchargement
Mise à jour 12 juin 2024

Afficher la licence

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.

Citation pour cette source

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. Extrait(e) le .

Compatibilité avec les versions de MATLAB
Créé avec R2022a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
1.0.1

Fixed description.

1.0.0