mercredi 22 avril 2015

How to get arglist from a function handle?

I have the following function handle

 fun = @(x,y,z)[x.^3+y.^2+z.^2,x.^2-y.^3+sin(z)]

And now I am using the function

jacobian(fun, [x,y,z])

which returns the jacobian of the function. To use this function I first need to define

syms x y z. 

If the function changes to

@(x,y,z,w)[x.^3+y.^2+z.^2+w,x.^2-y.^3+sin(z)+w] 

the jacobian is returned by

jacobian(fun, [x,y,z,w]). 

Now I don't want to change the second input argument of the jacobian manually. Is there a function in Matlab, that looks at the function handles and returns them, or returns how many there are?

Many thanks!

Aucun commentaire:

Enregistrer un commentaire