Hi,
I'm using matlab 2017b and want to find the gradient of a function with two arguments as defined in the mathwork site:
[FX,FY] = gradient(F) returns the x and y components of the two-dimensional numerical gradient of matrix F. The additional output FY corresponds to ∂F/∂y, which are the differences in the y (vertical) direction.
This is my code:
b=@(x,y) (x-1).^2+(x.^2+y).^2;
[dbdX,dbdY] = gradient(b)
The error I got is:
Undefined unary operator '.'' for input arguments of type 'function_handle'.
How do I solve this? Can somebody help me or give me a hint?
Best Answer