I have a function F that is a vector of functions in n variables. For example, consider the following:
syms x y z f(f1,f2,f3) f1(x,y,z) f2(x,y,z) f3(x,y,z)
X0 = [1 0 1 0]';
f1(x,y,z) = x+y+2;
f2(x,y,z) = w-5*x+z^2-4;
f3(x,y,z) = 2*x+y^2-z-12;
F = vertcat(f1, f2, f3)
Here, F is a vector of three functions in three variables. In the case I am considering, I want F to be considered n equations in n variables.
I want to take a vector of scalars the length of F, like the following:
X = [1 2 3]';
and evaluate F at this vector. So something like:
F(X(1),X(2),X(3))
However, I need a way to write that without knowing n. I could find n by writing
dims = size(X);
But that doesn't solve how I parametrically evaluate F at X. Is there a way to do this?
If you don't mind using cells instead of arrays, you can replace X = [1 2 3]'
by X = {1 2 3}
(the transpose is not necessary) and F(x(1),x(2),x(3))
by F(X{:})
.