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

Home » Public Forums » archive » Re: 2-d fitting
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: 2-d fitting [message #63522] Wed, 12 November 2008 10:00 Go to next message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
"xqinshan" <xqinshan@tom.com> wrote in message
news:2dec9a37-fe3b-4999-a80b-e47d06c5e13a@v22g2000pro.google groups.com...
> Hi,
> I have a set of data zi at indepent vaiables (xi,yi). I want to get
> coefficients of a fiting function such as f(x,y)=a*f1(x,y)+b*f2(x,y)
> +c*f3(x,y)+..., f1(x,y),f2(x,y)... are given by myself. If f1(x,y),f2
> (x,y)... are polunomials, we can use sfit or mpfitfun to do it. Are
> there any routins to do it?
>
> thanks,
>
> Xqinshan

Just write out the A matrix (in Ax = b, where x is unknown, b is your data,)
and fire it off to the svd routines.

The 'two dimensions' are just columns.
For instance:
1, x,y,xy,x^2,y^2

Cheers,
bob
Re: 2-d fitting [message #63532 is a reply to message #63522] Wed, 12 November 2008 05:29 Go to previous messageGo to next message
xqinshan is currently offline  xqinshan
Messages: 21
Registered: November 2008
Junior Member
On 11月12日, 下午3时02分, Craig Markwardt <cbmarkwa...@gmail.com> wrote:
> On Nov 12, 12:25 am, xqinshan <xqins...@tom.com> wrote:
>
>> Hi,
>> I have a set of data zi at indepent vaiables (xi,yi). I want to get
>> coefficients of a fiting function such as f(x,y)=a*f1(x,y)+b*f2(x,y)
>> +c*f3(x,y)+..., f1(x,y),f2(x,y)... are given by myself. If f1(x,y),f2
>> (x,y)... are polunomials, we can use sfit or mpfitfun to do it. Are
>> there any routins to do it?
>
> Yes, but MPFITFUN is not limited to polynomials, it can be any
> function you wish, including multiple variables.
>
> http://www.physics.wisc.edu/~craigm/idl/fitqa.html#multivar
>
> If the user function is a linear combination of known functions, then
> SVDFIT can also be used.
>
> Craig

I have tried cof=svdfit([x,y],z,a=a), it returns "SVDFIT: The input X
must be a vector"!
Re: 2-d fitting [message #63540 is a reply to message #63532] Tue, 11 November 2008 23:02 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Nov 12, 12:25 am, xqinshan <xqins...@tom.com> wrote:
> Hi,
> I have a set of data zi at indepent vaiables (xi,yi). I want to get
> coefficients of a fiting function such as  f(x,y)=a*f1(x,y)+b*f2(x,y)
> +c*f3(x,y)+..., f1(x,y),f2(x,y)... are given by myself.  If f1(x,y),f2
> (x,y)... are polunomials, we can use sfit or mpfitfun to do it.  Are
> there any routins to do it?

Yes, but MPFITFUN is not limited to polynomials, it can be any
function you wish, including multiple variables.

http://www.physics.wisc.edu/~craigm/idl/fitqa.html#multivar

If the user function is a linear combination of known functions, then
SVDFIT can also be used.

Craig
Re: 2-d fitting [message #63613 is a reply to message #63522] Wed, 12 November 2008 17:39 Go to previous message
xqinshan is currently offline  xqinshan
Messages: 21
Registered: November 2008
Junior Member
On 11月13日, 上午2时00分, "R.G. Stockwell" <notha...@noemail.com> wrote:
> "xqinshan" <xqins...@tom.com> wrote in message
>
> news:2dec9a37-fe3b-4999-a80b-e47d06c5e13a@v22g2000pro.google groups.com...
>
>> Hi,
>> I have a set of data zi at indepent vaiables (xi,yi). I want to get
>> coefficients of a fiting function such as f(x,y)=a*f1(x,y)+b*f2(x,y)
>> +c*f3(x,y)+..., f1(x,y),f2(x,y)... are given by myself. If f1(x,y),f2
>> (x,y)... are polunomials, we can use sfit or mpfitfun to do it. Are
>> there any routins to do it?
>
>> thanks,
>
>> Xqinshan
>
> Just write out the A matrix (in Ax = b, where x is unknown, b is your data,)
> and fire it off to the svd routines.
>
> The 'two dimensions' are just columns.
> For instance:
> 1, x,y,xy,x^2,y^2
>
> Cheers,
> bob

Good! Thank you.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: latitude, longitude and a data point
Next Topic: How to control character size freely?

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

Current Time: Wed Oct 08 13:44:40 PDT 2025

Total time taken to generate the page: 0.00470 seconds