When using str2func, I find that I can do these things such as,
str = 'x(1)^2 + 3*x(2)';f = str2func(['@(x)' str]);f([4 5])
and
str1 = 'x + 2*u';f1 = str2func(['@(x,u)' str1]);f1(2,3)
However, what I need is something like
str2 = 'x(1) + u - x(2)';f2 = str2func('@(x,u)', str2);f2([1,2],3)
which gives me an error "Too many input arguments."
Any suggestions please? Thank you all in advance.
Qun
Best Answer