I'm a user of IDL for just two weeks.
I want to use function curvefit,but find something hard to understand.
for example:
PRO gfunct, X, A, F, pder
bx = EXP(A[1] * X)
F = A[0] * bx + A[2]
pder = [[bx], [A[0] * X * bx], [replicate(1.0, N_ELEMENTS(X))]]
END
X = FLOAT(INDGEN(10))
Y = [12.0, 11.0, 10.2, 9.4, 8.7, 8.1, 7.5, 6.9, 6.5, 6.1]
weights = 1.0/Y
A = [10.0,-0.1,2.0]
yfit = CURVEFIT(X, Y, weights, A, SIGMA, FUNCTION_NAME='gfunct')
PRINT, 'Function parameters: ', A
IDL prints:
Function parameters: 9.91120 -0.100883 2.07773
|