How to define a vector of symbolic functions
25 views (last 30 days)
Show older comments
Likun
on 10 Dec 2013
Commented: Walter Roberson
on 10 Dec 2013
Hi all,
I have a vector of functions f(x), where f and x are vectors. For example,
f(x)=[x1^2+x2-x3; x2+x3^2; x1*x2];
How could I declare such function? Thank you.
0 Comments
Accepted Answer
Walter Roberson
on 10 Dec 2013
You could try,
syms x
f = symfun([x1^2+x2-x3; x2+x3^2; x1*x2], x);
but that might instead create a single function that returns an array. More sure would be
f = arrayfun(@symfun, [x1^2+x2-x3; x2+x3^2; x1*x2], x)
You would have had to have defined x1, x2, and x3 before this, and it seems odd that you would define a function with argument x but not use x anywhere in the function.
2 Comments
More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!