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 #76112] Tue, 17 May 2011 19:35 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On May 17, 3:53 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
> 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.

Yep, what he said.
Craig
[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: Wed Oct 08 15:22:34 PDT 2025

Total time taken to generate the page: 0.00361 seconds