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

Re: extrapolation of surface



Hi Alexander,

"Alexander Rauscher" <e9121161@stud4.tuwien.ac.at> wrote:
>
> i have a function f(x,y) which is f(x,y) != 0 on a more or less circular
> region which lies within an e.g. 128x128 array and 0 outside this region.
> now i want to extrapolate this function (over a range of e.g 10 pixles)
> into the region outside this circular region without the result being
> influenced by all the f(x,y)=0.
> sfit also takes into account where f(x,y)=0, which makes the fitted
> surface fit(x,y) decrease towards the edge of my array which is not what i
> want. (knowing from the shape of the original f(x,y) that it should
> increase...)

A few months ago, I came up against a similar problem and thought: "SFIT is
nice, but what if I want to fit a set of points that aren't on a full,
regular, X-Y grid". So I massaged the matrix algebra magic in the SFIT code
(which I still don't fully understand!) to work on an arbitrary set of XYZ
points.

Then you need a way to use the polynomial to get Z values from X, Y and the
KX parameters, so I'm throwing in an even less-fully-documented function to
do that.

An example program to test this is attached as well, it shows how you'd use
it if you really *had* an XY grid full of data (easier to see the result). I
wish I had more time to make this pretty or to apply it to your exact
problem, but I have a pressing deadline to meet. Let me know if you need a
hand with applying it to your problem.

I hope this is of some help, but you never know, there may be enhancements
to fitting features like this in upcoming releases of IDL...

--
-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


begin 666 SFitXYZ.pro
M1E5.0U1)3TX@4T9I=%A96BP@>'EZ+"!D96=R964L($M8/6MX#0H-"CLK#0H[
M($Y!344Z#0H["5-&251865H-"CL-"CL@4%524$]313H-"CL)5&AI<R!F=6YC
M=&EO;B!D971E<FUI;F5S(&$@<&]L>6YO;6EA;"!F:70@=&\@82!S970@;V8@
M6%E:('!O:6YT<RX-"CL-"CL@0T%414=/4EDZ#0H["4-U<G9E(&%N9"!S=7)F
M86-E(&9I='1I;F<N#0H[#0H[($-!3$Q)3D<@4T51545.0T4Z#0H["5)E<W5L
M=" ](%-&251865HH1&%T82P@1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=6)L92AK:R C(%1R86YS<&]S92AX>7I;,BP@*ETI*0T*
M:W@@/2!2969O<FTH36%T<FEX7TUU;'1I<&QY*&MK+"!X>7I;,BP@*ETL("]"
M5')A;G-P;W-E*2P@9&5G<F5E*S$L(&1E9W)E92LQ*0T*#0IF:70@/2!2969O
E<FTH:W@L(&XR*2 C('5T#0I2971U<FXL(&9I= T*#0I%3D0-"@``
`
end

begin 666 Polynom2DFunction.pro
M1E5.0U1)3TX@4&]L>6YO;3)$1G5N8W1I;VXL('@L('DL('!A<FUS#0H-"CL[
M(" @($=I=F5N(&EN<'5T(&%R<F%Y<R!O9B!8(&%N9"!9('9A;'5E<R!A;F0@
M82!M871R:7@@;V8@<&]L>6YO;6EA; T*.SL@(" @8V]E9F9I8VEE;G1S(&EN
M(%!!4DU3+"!R971U<FX@86X@87)R87D@;V8@6B!V86QU97,N#0H-"CL[(" @
M($YO=&4Z('!A<FUS(&%R<F%Y(&UA=&-H97,@<&%R;7-;:BP@:5T@=VET:"!X
M7FD@86YD('E>:BP@87,@<&5R(%-&250-"@T*248@4VEZ92AX+" O3E]$:6UE
M;G-I;VYS*2!%42 P(%1(14X@<F5S=6QT(#T@,$0@) T*14Q312!R97-U;'0@
M/2!-86ME7T%R<F%Y*"]$;W5B;&4L($1I;65N<VEO;CU3:7IE*'@L("]$:6UE
M;G-I;VYS*2D-"@T*9&5G<F5E(#T@4W%R="A.7T5L96UE;G1S*'!A<FUS*2D-
M"D9/4B!I/3 L(&1E9W)E92TQ($1/($9/4B!J/3 L(&1E9W)E92TQ($1/("0-
M"B @(')E<W5L=" ](')E<W5L=" K('!A<FUS6VHL(&E=("H@>%YI("H@>5YJ
9#0I2971U<FXL(')E<W5L= T*#0I%3D0-"@``
`
end

begin 666 SFitXYZTest.pro
M;B ](#8Q#0IX(#T@*$9)3D1'14XH;BDI(",@4D503$E#051%*#$L;BD@*B P
M+C$-"GD@/2!44D%.4U!/4T4H6"D-"GH@/2 M4TE.*#(J>"D@*R!#3U,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