MATLAB: ‘fminunc’ function

fminunc functionMATLAB

Hello,
I am using 'fminunc' function that I expected to have it as long as the machine learning tool box is installed. the toolbox is installed but I am getting this error: " 'fminunc' requires Optimization Toolbox". Could you please advise?
Thanks,
Hamid

Best Answer

See the documentation on fminunc (link). It always has been part of the Optimization Toolbox.
Depending on the problem you are solving, you might be able to use the fminsearch (link) function. You may have to use it with the norm (link) function to get the same results
For example:
x = rand(5,1);
YourFunction = @(p) p(1).^2 + p(2).*x - 10;
P = fminsearch(@(p) norm(YourFunction(p)), [1; 1])