passing gradient when using fminunc

passing gradient when using fminunc

Post by Jayanth Ja » Thu, 03 Apr 2008 14:41:02


Hey folks,

I am trying to make use of the gradient of the function and
then minimize using fminunc in an unconstrained problem.
I have done as specified by the help file (incorporating
optimset and all that) but an error is being generated. If i
don't pass the gradient it find the minimum using a line
search instead of trust region method. I list the error
message below. Any help is appreciated.

??? In an assignment A(:) = B, the number of elements in A
and B
must be the same.

Error in ==> fminunc at 204
[f,GRAD(:)] = feval(funfcn{3},x,varargin{:});