# GAUSS2DFIT - TILT ?

• Subject: GAUSS2DFIT - TILT ?
• From: "Zeschke" <zeschke(at)bessy.de>
• Date: Mon, 11 Dec 2000 14:45:55 +0100
• Newsgroups: comp.lang.idl-pvwave
• Xref: news.doit.wisc.edu comp.lang.idl-pvwave:22577

```Why does the following example not work correctly ?
This program use the "GAUSS2DFIT.PRO" - Routine. The "Tilt"-Parameter-Fit
does not work.
What can I do ?

Thanks for any help
Thomas

;******************************

; Define array dimensions.
nx = 128 & ny = 128
; Define input function parameters.
A = [ 5., 100., nx/8., ny/20., nx/2., .6*ny]

; Create X and Y arrays.
X = FINDGEN(nx) # REPLICATE(1.0, ny)
Y = REPLICATE(1.0, nx) # FINDGEN(ny)

;Tilt
T=1.

h=A[4]
k=A[5]
x1 = (x - h) * cos(T) - (y - k) * sin(T)
y1 = (x - h) * sin(T) + (y - k) * cos(T)
U = (X1/A[2])^2 + (Y1/A[3])^2; Create an ellipse.
xvec=x[*,0]
yvec=y[0,*]
yvec=transpose(yvec)

Z = A[0] + A[1] * EXP(-U/2) ; Create gaussian Z.
Z = Z + RANDOMN(seed, nx, ny) ; Add random noise, SD = 1.
yfit = GAUSS2DFIT(Z,B,xvec,yvec, /tilt) ; Fit the function with rotation.

PRINT, '         constant scale width_x width_y center_x center_y tilt'
PRINT, 'Should:', STRING(A,T, FORMAT='(6f8.3)')
PRINT, 'Is:    ', STRING(B(0:6), FORMAT='(6f8.3)')
contour,z,x,y,/fill,nlevels=30
contour,yfit,x,y,/noerase

;******************************

```