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

Home » Public Forums » archive » Re: Plane fit
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: Plane fit [message #39149 is a reply to message #39094] Tue, 20 April 2004 08:55 Go to previous messageGo to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
Hi Steve,

"Steve" <Steve.Morris@libero.it> wrote in message
news:606669c3.0404200355.71209718@posting.google.com...
> Hi!
> I was wondering if there is any function/routine to compute a 2
> dimensional fit (i.e. a surface) that fits a series of points spread
> in 3-dim space.
> Cheers,
> S.

This is what I use, based on Craig Markwardt's excellent MPFIT routines
(you'll need at least mpfit.pro and mpfit2dfun.pro from
http://cow.physics.wisc.edu/~craigm/idl/fitting.html):

;----------------------------------------

FUNCTION Plane2DFunction, x, y, parms, dParms
; parms define a plane: [c00, c01, c10] (1st-order polynomial in 2
vbles)
Return, parms[0] + parms[1]*x + parms[2]*y
END

;----------------------------------------

;; Then, if data is a (3, n) array of xyz points...

fitParms = MPFIT2DFUN('Plane2DFunction', $
data[0, *], data[1, *], data[2, *], $
0D, $ ; Error measure, ignored with Weights...
[Mean(data[2, *]), 0D, 0D], $ ; Estimate
Weights=Replicate(1D, nPts), /Quiet)

;; Then, for any x and y values...

fitZ = Plane2DFunction(x, y, fitParms)

;-----------------------------------------

Hope this helps!

Cheers,
--
-Dick

Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: spreadable meat
Next Topic: Reading in a string file

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

Current Time: Sat Oct 11 11:15:57 PDT 2025

Total time taken to generate the page: 0.71921 seconds