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

Home » Public Forums » archive » Re: Piecewise curve fitting in idl
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Piecewise curve fitting in idl [message #61776] Fri, 01 August 2008 01:27 Go to next message
Wox is currently offline  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 Go to previous messageGo to next message
jameskuyper is currently offline  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 Go to previous messageGo to next message
pgrigis is currently offline  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 Go to previous messageGo to next message
Paul Van Delst[1] is currently offline  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 #61784 is a reply to message #61782] Thu, 31 July 2008 07:03 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
d.poreh@gmail.com writes:

> how we can do this in Iplot?

This is so much better than one of those serialized novels!!

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Piecewise curve fitting in idl [message #61785 is a reply to message #61784] Thu, 31 July 2008 07:00 Go to previous messageGo to next message
d.poreh is currently offline  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 Go to previous messageGo to next message
jameskuyper is currently offline  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 #61793 is a reply to message #61788] Thu, 31 July 2008 04:54 Go to previous messageGo to next message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
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
Re: Piecewise curve fitting in idl [message #61797 is a reply to message #61793] Thu, 31 July 2008 04:21 Go to previous messageGo to next message
Wox is currently offline  Wox
Messages: 184
Registered: August 2006
Senior Member
On Thu, 31 Jul 2008 03:30:22 -0700 (PDT), d.poreh@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)
Re: Piecewise curve fitting in idl [message #61901 is a reply to message #61793] Sun, 03 August 2008 21:58 Go to previous message
Craig Markwardt is currently offline  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
------------------------------------------------------------ --------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Surface fitting image with missing data
Next Topic: Re: Edge detection and convert edges into polygons

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

Current Time: Wed Oct 08 15:14:59 PDT 2025

Total time taken to generate the page: 0.00663 seconds