comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDL fitting of piecewise continuous function
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL fitting of piecewise continuous function [message #76114 is a reply to message #76112] Tue, 17 May 2011 12:53 Go to previous messageGo to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
If you define your function analogously to the example in the MPFIT code, it might look like:

FUNCTION MYFUNCT, p, X=x, Y=y, ERR=err
; p[0] is A
x_m = SOME_CONSTANT_VALUE

; x lt x_m is 1 if x<x_m and 0 otherwise
; x ge x_m is 1 if x >= x_m and 0 otherwise
model = (x lt x_m) * p[0] * x^(0.5) + (x ge x_m) * p[0] * x_m^(1.5) / x

return, (y-model)/err
END


Of course, that assumes that x_m is a constant, not a parameter - but if it's a parameter, you would just use p[1] instead of a constant value, for example.

-Jeremy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL fitting of piecewise continuous function
Next Topic: HISTOGRAM, binsize, and max

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 22:26:21 PDT 2025

Total time taken to generate the page: 0.32072 seconds