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

Home » Public Forums » archive » MPFIT/MPFIT2DFUN (Markwardt)
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: MPFIT/MPFIT2DFUN (Markwardt) [message #23073 is a reply to message #22929] Sat, 23 December 2000 13:07 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
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
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Previous Topic: BEETLE FOR SALE
Next Topic: Real-Time I/O Capabilities/Limitations in IPL?

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

Current Time: Wed Dec 03 00:43:32 PST 2025

Total time taken to generate the page: 0.79913 seconds