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

Home » Public Forums » archive » surface fitting...
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: surface fittin [message #42974 is a reply to message #10785] Fri, 04 March 2005 15:12 Go to previous message
mchinand is currently offline  mchinand
Messages: 66
Registered: September 1996
Member
In article <d09orm$u9k$1@news.iucc.ac.il>, Tal <ftal@post.tau.ac.il> wrote:
> hello,
>
> i worked with SFIT for that and used a 6th order polynomial which does a
> good job (when looking at the output image it creates). however, when trying
> to reconstruct that image that i see, by using the required x, y and the
> coefficients, the resulting surface is far from being similar to what the
> surface really is. i managed to fully and exactly reconstruct a 3x3
> Gaussian. so i know that i read the KX coefficients correctly. i also
> defined my x and y variables correctly (100% sure). but is doesn't work for
> my 72x15 pixels surface. KX is a floating point output. it could be that
> when saved as double precision, results will be better. but there is no
> keyword for that.

It seems to work for the example in the online help:

=============================================
X = (FINDGEN(61)/10) # REPLICATE(1,61)
Y = TRANSPOSE(X)
; Evaluate a function at each point:
F = -SIN(2*X) + COS(Y/2)
; Compute a sixth-degree polynomial fit to the function data:
result = SFIT(F, 6, kx=k)
=================================================

Now to get the fit from coefficients, first multiply the x and y arrays by 10 since the fit was
done with array indices and not the x and y values used to create F.

x=x*10.
y=y*10.

Create an array for the fit and then loop through the coefficients
fit=fltarr(61,61)
for i=0,6 do for j=0,6 do fit=fit+k(j,i)*x^i*y^j

Hope this helps,

--Mike

--
Michael Chinander
m-chinander@uchicago.edu
Department of Radiology
University of Chicago
[Message index]
 
Read Message
Read Message
Previous Topic: Re: On Pointers and Culture
Next Topic: Update Mandrake from 10.0 to 10.1 and nothing work again

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

Current Time: Sat Nov 29 11:09:16 PST 2025

Total time taken to generate the page: 0.56459 seconds