Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Math Forum
»
Discussions
»
Software
»
comp.softsys.matlab
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
leastsquares fitting: Setting up the objective function
Replies:
3
Last Post:
Jan 31, 2014 9:50 AM



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.



