Fit a background with a P3
Macro PAWEX15A ID=30001 IP1=40 IP2=111 IZ1=33 IZ2=150 LOOP=20
*
Set 2BUF 1
Hi/file 1 pawtut.hbook ; Hrin [ID]
Set FWID 6 ; Set DMOD 1
1 NBIN = $HINFO([ID],'XBINS')
Vector/Create FUNC([NBIN])
Vector/Create Y([NBIN])
Vector/Create S([NBIN])
Vector/Create X([NBIN],[LOOP])
Histogram/Copy [ID] 1
Histogram/Copy [ID] 2
*
2 Do i=1,[LOOP]
Histogram/Plot 1
3 Histogram/Fit 1([IZ1]:[IZ2]) P3 0q
3 Get/Func 1 FUNC ; Put/Cont 2 FUNC
3 Sub 1 2 3
4 Histogram/Fit 3([IP1]:[IP2]) G 0q
Histogram/Plot 3([IP1]:[IP2]) FUNCS
4 Get/Func 3 FUNC ; Put/Cont 2 FUNC
4 Sub 1 2 1
Get/Func 3 X(1:[NBIN],[i])
Call igterm
Enddo
*
Get/Func 1 FUNC ; Put/Cont 2 FUNC
Sub [id] 2 3
Zone 1 2
Histogram/Plot [ID]
Histogram/Plot 1 FUNCS
5 Do i=1,[LOOP]
Vector/Copy X(1:[NBIN],[i]) Y
SIGMA S = S + Y
SIGMA Y = Y+FUNC
Put/Cont 2 Y
Histogram/Plot 2([IP1]:[IP2]) SL
Enddo
Histogram/Plot 3([IP1]:[IP2]) HIST
Put/Cont 2 S
Histogram/plot 2([IP1]:[IP2]) Sl
*
Close 1
V/Del FUNC,X,Y,S ; H/Del 1,2,3
|