Re: Piecewise curve fitting in idl [message #61776] |
Fri, 01 August 2008 01:27  |
Wox
Messages: 184 Registered: August 2006
|
Senior Member |
|
|
On Thu, 31 Jul 2008 07:00:21 -0700 (PDT), d.poreh@gmail.com wrote:
<snip>
> how we can do this in Iplot?
Just checked iplot and Dave was right, you can tighten a screw with a
toothbrush: "Operations > Filter > Curve Fitting". This is using
CURVEFIT (check idlitopcurvefitting__define.pro).
As for your piecewise fitting Dave, you will have to call curvefit (or
another fitting routine) outside iplot.
|
|
|
Re: Piecewise curve fitting in idl [message #61779 is a reply to message #61776] |
Thu, 31 July 2008 07:58   |
jameskuyper
Messages: 79 Registered: October 2007
|
Member |
|
|
d.poreh@gmail.com wrote:
> On 31 Jul., 05:39, James Kuyper <jameskuy...@verizon.net> wrote:
...
>> Identifying the different parts is up to you. How do you know that there
>> are 2-3 different trends? Whatever method you use to reach that
>> conclusion will have to be adequate to identify where the different
>> trends start and end. However, once you have identified the different
>> parts you want fit separately, fitting each one separately is trivial:
>> pass x[trend_start[i]:trend_end[i]] and y[trend_start[i]:trend_end[i]]
>> to the curve-fitting routine.
>>
>> If you want a curve fitting routine that automatically figures out where
>> each trend starts and ends, then it gets a LOT more complicated. You
>> could do that by using a non-linear curve fitting routine, and make the
>> transition point between the two trends be one of the parameters of your
>> fitting curve. However, I would strongly recommend trying to understand
>> why you see 2 or 3 different trends, and then try to come up with a
>> single mathematical model for the entire curve that reflects that
>> reason. Then fit that model to your data.- Zitierten Text ausblenden -
>>
>> - Zitierten Text anzeigen -
>
> how we can do this in Iplot?
I don't have any idea. Iplot is a plotting routine, not a curve fitting
routine, so I wouldn't expect it to be possible at all; but I'm not very
familiar with Itools, so I could be mistaken.
|
|
|
Re: Piecewise curve fitting in idl [message #61781 is a reply to message #61779] |
Thu, 31 July 2008 07:41   |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
d.po...@gmail.com wrote:
> On 31 Jul., 05:39, James Kuyper <jameskuy...@verizon.net> wrote:
>> d.po...@gmail.com wrote:
>>> On Jul 31, 1:21 pm, Wox <nom...@hotmail.com> wrote:
>>>> On Thu, 31 Jul 2008 03:30:22 -0700 (PDT), d.po...@gmail.com wrote:
>>>> > Folks
>>>> > How we can do the piecewise curve fitting in idl. Say we have an array
>>>> > that this array has got 2 or 3 trends in data and we want to fit a
>>>> > liner curve for each trends. In MATLAB curve fitting tool, we can
>>>> > easily exclude or include a part of data and then fit a curve. How we
>>>> > can do this in IDL
>>>> > Cheers
>>>> > Dave
>>>> Euhm, just do the fitting on the different parts? Or do you mean
>>>> fitting with a piecewise polynomial (i.e. spline: see e.g. IMSL_BSLSQ
>>>> or IMSL_CONLSQ)
>>
>>> just doing the fitting on the difrent part. how we can select this
>>> parts and how we can fit a curve to these parts separatly?
>>> Cheers
>>
>> Identifying the different parts is up to you. How do you know that there
>> are 2-3 different trends? Whatever method you use to reach that
>> conclusion will have to be adequate to identify where the different
>> trends start and end. However, once you have identified the different
>> parts you want fit separately, fitting each one separately is trivial:
>> pass x[trend_start[i]:trend_end[i]] and y[trend_start[i]:trend_end[i]]
>> to the curve-fitting routine.
>>
>> If you want a curve fitting routine that automatically figures out where
>> each trend starts and ends, then it gets a LOT more complicated. You
>> could do that by using a non-linear curve fitting routine, and make the
>> transition point between the two trends be one of the parameters of your
>> fitting curve. However, I would strongly recommend trying to understand
>> why you see 2 or 3 different trends, and then try to come up with a
>> single mathematical model for the entire curve that reflects that
>> reason. Then fit that model to your data.- Zitierten Text ausblenden -
>>
>> - Zitierten Text anzeigen -
>
> how we can do this in Iplot?
how can we tighten a screw with a toothbrush?
Paolo
|
|
|
Re: Piecewise curve fitting in idl [message #61782 is a reply to message #61781] |
Thu, 31 July 2008 07:31   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
d.poreh@gmail.com wrote:
>
> how we can do this in Iplot?
Goodness. I think you need to (re)start using Matlab. The IDL gui's don't offer anything
similarly sophisticated. Blood, sweat, and tears are still the order of the day to use IDL
effectively - which, lest readers get confused, is sometimes A Good Thing, IMO. If the gui
does most of the work, the new user doesn't really learn anything.
Reminds me of that Star Trek movie where they went back in time to the '80s where Scottie
sat in front of a Macintosh, said "Computer", and then waited for a reply.
Ahhh, good times good times....
cheers,
paulv
|
|
|
|
Re: Piecewise curve fitting in idl [message #61785 is a reply to message #61784] |
Thu, 31 July 2008 07:00   |
d.poreh
Messages: 406 Registered: October 2007
|
Senior Member |
|
|
On 31 Jul., 05:39, James Kuyper <jameskuy...@verizon.net> wrote:
> d.po...@gmail.com wrote:
>> On Jul 31, 1:21 pm, Wox <nom...@hotmail.com> wrote:
>>> On Thu, 31 Jul 2008 03:30:22 -0700 (PDT), d.po...@gmail.com wrote:
>>>> Folks
>>>> How we can do the piecewise curve fitting in idl. Say we have an array
>>>> that this array has got 2 or 3 trends in data and we want to fit a
>>>> liner curve for each trends. In MATLAB curve fitting tool, we can
>>>> easily exclude or include a part of data and then fit a curve. How we
>>>> can do this in IDL
>>>> Cheers
>>>> Dave
>>> Euhm, just do the fitting on the different parts? Or do you mean
>>> fitting with a piecewise polynomial (i.e. spline: see e.g. IMSL_BSLSQ
>>> or IMSL_CONLSQ)
>
>> just doing the fitting on the difrent part. how we can select this
>> parts and how we can fit a curve to these parts separatly?
>> Cheers
>
> Identifying the different parts is up to you. How do you know that there
> are 2-3 different trends? Whatever method you use to reach that
> conclusion will have to be adequate to identify where the different
> trends start and end. However, once you have identified the different
> parts you want fit separately, fitting each one separately is trivial:
> pass x[trend_start[i]:trend_end[i]] and y[trend_start[i]:trend_end[i]]
> to the curve-fitting routine.
>
> If you want a curve fitting routine that automatically figures out where
> each trend starts and ends, then it gets a LOT more complicated. You
> could do that by using a non-linear curve fitting routine, and make the
> transition point between the two trends be one of the parameters of your
> fitting curve. However, I would strongly recommend trying to understand
> why you see 2 or 3 different trends, and then try to come up with a
> single mathematical model for the entire curve that reflects that
> reason. Then fit that model to your data.- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -
how we can do this in Iplot?
|
|
|
Re: Piecewise curve fitting in idl [message #61788 is a reply to message #61785] |
Thu, 31 July 2008 05:39   |
jameskuyper
Messages: 79 Registered: October 2007
|
Member |
|
|
d.poreh@gmail.com wrote:
> On Jul 31, 1:21 pm, Wox <nom...@hotmail.com> wrote:
>> On Thu, 31 Jul 2008 03:30:22 -0700 (PDT), d.po...@gmail.com wrote:
>>> Folks
>>> How we can do the piecewise curve fitting in idl. Say we have an array
>>> that this array has got 2 or 3 trends in data and we want to fit a
>>> liner curve for each trends. In MATLAB curve fitting tool, we can
>>> easily exclude or include a part of data and then fit a curve. How we
>>> can do this in IDL
>>> Cheers
>>> Dave
>> Euhm, just do the fitting on the different parts? Or do you mean
>> fitting with a piecewise polynomial (i.e. spline: see e.g. IMSL_BSLSQ
>> or IMSL_CONLSQ)
>
> just doing the fitting on the difrent part. how we can select this
> parts and how we can fit a curve to these parts separatly?
> Cheers
Identifying the different parts is up to you. How do you know that there
are 2-3 different trends? Whatever method you use to reach that
conclusion will have to be adequate to identify where the different
trends start and end. However, once you have identified the different
parts you want fit separately, fitting each one separately is trivial:
pass x[trend_start[i]:trend_end[i]] and y[trend_start[i]:trend_end[i]]
to the curve-fitting routine.
If you want a curve fitting routine that automatically figures out where
each trend starts and ends, then it gets a LOT more complicated. You
could do that by using a non-linear curve fitting routine, and make the
transition point between the two trends be one of the parameters of your
fitting curve. However, I would strongly recommend trying to understand
why you see 2 or 3 different trends, and then try to come up with a
single mathematical model for the entire curve that reflects that
reason. Then fit that model to your data.
|
|
|
|
|
Re: Piecewise curve fitting in idl [message #61901 is a reply to message #61793] |
Sun, 03 August 2008 21:58  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
d.poreh@gmail.com writes:
> On Jul 31, 1:21�pm, Wox <nom...@hotmail.com> wrote:
>> On Thu, 31 Jul 2008 03:30:22 -0700 (PDT), d.po...@gmail.com wrote:
>>> Folks
>>> How we can do the piecewise curve fitting in idl. Say we have an array
>>> that this array has got 2 or 3 trends in data and we want to fit a
>>> liner curve for each trends. In MATLAB curve fitting tool, we can
>>> easily exclude or include a part of data and then fit a curve. How we
>>> can do this in IDL
>>> Cheers
>>> Dave
>>
>> Euhm, just do the fitting on the different parts? Or do you mean
>> fitting with a piecewise polynomial (i.e. spline: see e.g. IMSL_BSLSQ
>> or IMSL_CONLSQ)
>
> just doing the fitting on the difrent part. how we can select this
> parts and how we can fit a curve to these parts separatly?
I realize I'm coming into this discussion late. However, the IDL
Astronomy library has a nice procedure LINTERP which would be very
useful for an application like this. It would still need to be
interfaced to a fitting function. It would allow you to fit the
tabulated Y values, and in principle even the tabulated-X positions,
although I would NOT advise that.
For a graphical interface, IDL is probably not the best application
unless you want to write the whole program yourself.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|