[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*Subject*: Re: MPFIT/MPFIT2DFUN (Markwardt)*From*: Craig Markwardt <craigmnet(at)cow.physics.wisc.edu>*Date*: 23 Dec 2000 15:07:13 -0600*Newsgroups*: comp.lang.idl-pvwave*Organization*: U. Wisc. Madison Physics -- Compact Objects*References*: <920gqb$sqk$1@nnrp1.deja.com>*Reply-To*: craigmnet(at)cow.physics.wisc.edu*Xref*: news.doit.wisc.edu comp.lang.idl-pvwave:22741

Greetings! The function MPFIT2DFUN is designed to fit gridded 2-dimensional data, ie an image. However, the task you are asking, a scalar function of two variables, is not very hard to do with the standard MPFITFUN. I even cover it as a frequently asked question on my web page (hint, hint...). What you want to do is make a *single*, *two*-dimensional independent variable consisting of both your X and Y data. MPFITFUN doesn't care that your independent variable is of different dimension than the dependent variable. Your new independent variable would be constructed like this: XY = [[X],[Y]] You would call MPFITFUN with XY as your independent variable, and Z as your dependent variable. You need to make sure that your user function can split this independent data array apart: function myfunc, xy, p x = xy(*,0) y = xy(*,1) ... continue with calculations ... end Good luck, Craig endobeck@my-deja.com writes: > I have one-dimensional x, y, and z arrays, with x & y being positions > (independent variables), and z being an array of dependent variable > values. All 3 arrays have the same number of elements. > > I'd like to fit a function of two variables (a plane) to the > data, and I've been trying to use MPFIT2DFUN. It seems I have to make > the x & y arrays into 2-d arrays, but I am not clear as to why or how. > Can someone fill me in? > > Cheers, > Eli > > > Sent via Deja.com > http://www.deja.com/ -- -------------------------------------------------------------------------- Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response --------------------------------------------------------------------------

**References**:**MPFIT/MPFIT2DFUN (Markwardt)***From:*endobeck

- Prev by Date:
**Re: widget_control and group_leader** - Next by Date:
**Re: widget_control and group_leader** - Prev by thread:
**MPFIT/MPFIT2DFUN (Markwardt)** - Next by thread:
**widget_control and group_leader** - Index(es):