How to input a vector into a multi-variable symbolic function - Error using symfun/subsref

Hi,
I'm trying to generate a series of vectors using a recursive function. Say my initial vector is [1 1], and my function is f((x,y))=(x+1,y+2).
I've defined my function as follows:
syms x y;
f=symfun([x+1 y+2],[x y]);
I then want to apply f to the initial vector, but when I try to use
f([1 1])
I get the error
Error using symfun/subsref
Symbolic function expected 2 inputs and received 1.
How can I apply f to this vector? The issue is that the vector's dimensions vary, so I can't explicitly write
f(x1, x2, ... xn)
Thanks in advance!

Réponses (1)

okay it's a bit late but maybe someone else could use this
try this:
subs(symbolic_expression, list_of_variables, list_of_values)

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by