In my program, I first use command jacobian generate a symbolic gradient of my objective function.Then I call the function(gradient.m) and feed it with numeric value. But Matlab warned me likeWarning: Function "diff" is not verified to be a valid MATLAB function. Warning: Function "diff" is not verified to be a valid MATLAB function. Warning: Function "diff" is not verified to be a valid MATLAB function. Error using diff Difference order N must be a positive integer scalar. Error in gradient (line 10) t4 = diff(t2,B1); Error in mini_dist_noheter (line 60) dfb = gradient(b(1),b(2),b(3));
The gradient function file, main file and data see the attachment.
Best Answer