GS
Posts:
22
Registered:
4/19/12


Re: leastsquares fitting: Setting up the objective function
Posted:
Jan 31, 2014 9:38 AM


Thanks, I found about the summation question, just after I posted. However, I am still trying to understand the passing of the data. I found this in the same page (and my code works):
http://www.mathworks.com/help/optim/ug/passingextraparameters.html
The objective function is being set using an anonymous function: f = @(x)parameterfun(x,a,b,c)
I am trying to understand why this works. If I convert the above notation to something that I understand, it looks like this:
function returnVal = f(x) returnVal = parameterfun(x,a,b,c)
How is the function f(x) getting access to a,b,c; Are they somehow global variables in this context?
Thanks.

