Pretty basic, just trying an example from my Calc 3 class, and the gradient function refuses to work:
f = @(x) x*(1)^2 + x*(2)^2 + x(1)*x(2)*x(3);
a = [-2,1,-3];
h = 0.1;
df = gradient(f,a,h)
Command Window: Unary operator '.'' is not supported for operand of type 'function_handle'.
Error in gradient>parse_inputs (line 139) f = f.';
Error in gradient (line 48) [f,ndim,loc,rflag] = parse_inputs(f,varargin);
Error in lab4Examples (line 12) df = gradient(f,a,h)
tried both on MATLAB online as well as the WIN11 app, same result
Any help would be appreciated