The Math Forum

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.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 ]

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):

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?


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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.