Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: least-squares fitting: Setting up the objective function
Replies: 3   Last Post: Jan 31, 2014 9:50 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
GS

Posts: 22
Registered: 4/19/12
Re: least-squares fitting: Setting up the objective function
Posted: Jan 31, 2014 9:38 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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/passing-extra-parameters.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.





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.