Hi All,
I have a set of measurements, X and Y, and I need to fit a polynomial function with the following "constraints":
Y = a + bX + CX^2 + ((1-b-4C)/12)X^3
I tried to do this with the AMOEBA function but the result is not consistent at all. You can see my code below...
I need some help with this problem. Could anyone help me with this problem ?
Thank you in advance
nata
; First define the function FUNC:
FUNCTION FUNC P
COMMON FUNC_XY, X, Y
RETURN, MAX(ABS(Y - (P[0] + P[1]*X + P[2]*X^2 + ((1-P[1]-4*P[2]) / 12)*X^3)))
END
PRO PROGRAM
COMMON FUNC_XY, X, Y
X=[11.0,13.0,14.5,15.5,16.5,17.5,18.5,19.5,20.5,21.5,22.5,23 .5,24.5,25.5, $
26.5,27.5,28.5,29.5,30.5,31.5,32.5,33.5,34.5,35.5,37.0,39.0, 41.5,44.5,48.0]
Y=[-0.921,-0.735,-0.627,-0.554,-0.439,-0.379,-0.313,-0.247,- 0.186,-0.126, $
-0.092,-0.018,0.052,0.108,0.185,0.255,0.308,0.375,0.443,0.52 5,0.597,0.656, $
0.733,0.816,0.950,1.109,1.269,1.562,2.044]
R = AMOEBA(1.0e-25, SCALE=[1e2,1e2,1e2], P0=[0,0,0], FUNCTION_VALUE=fval, FUNCTION_NAME='FUNC')
PLOT, X, Y
OPLOT, X, (R[0] + R[1]*X + R[2]*X^2. + ((1-R[1]-4*R[2])/12)*X^3.), COLOR=222
END
|