I'm trying to find a way to pass a 1xn array into a function handler with n being the number of variables in the function so let's suppose I declare a handler as such:
U = @(x, y) x^2 + 2*y^2
and plugged in:
U(1, 2)
ans =
9
Is there some way I can do something similar to this instead?
a = [1, 2]
U(a)
ans =
9