MATLAB: Generation of symbolic vector of functions

symbolicSymbolic Math Toolbox

I need to define a lot of symbolic variables for DAE solver.
Instead of using
sym f1(t) f2(t) % up to arbitrary fN(t)
i would prefer something like this
sym('f_%d(t)',[1 N])
or similar. But it seems that use of parenthes is not allowed. Is possible to generate programatically such vectors?

Best Answer

syms("f_" + (1:N) + "(t)")
The output cannot be assigned to anything.
syms() must be used for this, not sym()
str2sym() will not work for this purpose, and instead will effectively give you back variable names that just happen to include '(' 't' ')' characters but which are not functions.
There is an alternative involving aarrayfun of a symfun call and 'uniform', 0