How to use mpfitfun.pro for fitting? [message #93364] |
Sun, 26 June 2016 22:14  |
Sonu Tabitha
Messages: 29 Registered: April 2016
|
Junior Member |
|
|
I went through the documentation but I didn't understand it much. Can anyone of you please give me a sample mpfitfun.pro (with the definition of function)?
PS:Infact I am having a set of flux values(measured) for 4 sources at 5 frequency bands. I know the expression of flux and it's a function of 5 parameters.
|
|
|
Re: How to use mpfitfun.pro for fitting? [message #93365 is a reply to message #93364] |
Mon, 27 June 2016 04:00   |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Monday, June 27, 2016 at 6:14:40 AM UTC+1, Meegle_Jade wrote:
> I went through the documentation but I didn't understand it much. Can anyone of you please give me a sample mpfitfun.pro (with the definition of function)?
>
> PS:Infact I am having a set of flux values(measured) for 4 sources at 5 frequency bands. I know the expression of flux and it's a function of 5 parameters.
Hi,
I'm not sure what the problem with the function definition is. In the instructions I found this:
; FUNCTION MYFUNCT, X, P
; ; The independent variable is X
; ; Parameter values are passed in "P"
; YMOD = ... computed model values at X ...
; return, YMOD
; END
And it worked for me. But anyhow, below is an example that works well for me (adapted from something that I use):
function mySineFunction, x, p
return, p[0] + p[1] * sin(x * p[2] /!radeg + p[3])
end
pro doTheFit, angles, xPos
;************* fit x ****************
xSineFit = double(angles)
ySineFit = double(xPos)
yerr = 1
starty = [-800d, 1000d, 1d, -90d]
xResult = mpfitfun('mySineFunction', xSineFit, ySineFit, yerr, startY)
print, xResult
end
I hope this helps.
Cheers,
Helder
|
|
|
|
|
|
Re: How to use mpfitfun.pro for fitting? [message #93375 is a reply to message #93364] |
Mon, 27 June 2016 18:57  |
Sonu Tabitha
Messages: 29 Registered: April 2016
|
Junior Member |
|
|
On Monday, June 27, 2016 at 10:44:40 AM UTC+5:30, Meegle_Jade wrote:
> I went through the documentation but I didn't understand it much. Can anyone of you please give me a sample mpfitfun.pro (with the definition of function)?
>
> PS:Infact I am having a set of flux values(measured) for 4 sources at 5 frequency bands. I know the expression of flux and it's a function of 5 parameters.
Thanks a lot!
|
|
|