Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21462 Discussions

Trouble with DRNLIN not updating IOBS data number

TheProfessor
Beginner
677 Views

I am using DINLAP to invert a LaPlace transformed equation, and then DRNLIN for least-squares fitting data EY to 5 unknown parameters THETA.  RNLIN subroutine does not update the data number IOBS and just recycles the IOBS=1 data point.  Not sure way or how to input the IOBS to DRNLIN, which must have the counter within the source code.  Here is the part that does not work.  DINLAP works fine.  Can you help?

IDERIV = 0 !Derivatives are obtained by finite differences

IOPT = 0 !Evaluate the function

CALL DRNLIN(FUNC,NPARM,IDERIV,THETA,R,LDR,IRANK,DFE,SSE)

**********************************************************************

SUBROUTINE FUNC (NPARM,THETA,IOPT,IOBS,FRQ,WT,DIF,DE,IEND)

INTEGER NUMPT,NOBS,IOBS,NPARM,N

COMMON NUMPT,NOBS,FINV

INTEGER KMAX,IOPT,NPT,IEND,LDR

REAL(8) EXP,FRQ,WT,DE(1),RELERR,THETA(NPARM),DIF,FINV

EXTERNAL F   !FUNCTION WITH LAPLACE TRANSFORM EQUATION
COMPLEX(8) F,S
INTRINSIC EXP

NOBS = 80
IF (IOBS .LE. NOBS) THEN     !IOBS SHOULD BE INCREASED TO NOBS BUT IT DOES NOT 

N = 1   !Number of DINLAP inverted data points at each time T(IOBS)
ALPHA = 0.0E0           !Estimated no. of singularities of F. Unknown = 0.
RELERR = 2.22D-7     !Default double precision relative accuracy
KMAX = 500                !Max number of function evaluations for each T(I)
CALL DINLAP(F,N,T,ALPHA,RELERR,KMAX,FINV) !Double Precision
WT = 1.0E0 !Frequency of observation: Output
FRQ = 1.0E0 !Weight for observation Output
IEND = 0    !IOBS .LE. NOBS
DIF = EY(IOBS) - FINV     !Difference used for DRNLIN
ELSE
IEND = 1      !IOBS > NOBS, FINISH AFTER NOBS POINTS FOR NEXT DRNLIN ITERATION???
END IF
RETURN
END

Labels (1)
0 Kudos
0 Replies
Reply