PROGRAM g13bdfe ! G13BDF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : g13bdf, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. REAL (KIND=nag_wp) :: r0, s INTEGER :: ifail, iwa, nl, nwds ! .. Local Arrays .. REAL (KIND=nag_wp), ALLOCATABLE :: r(:), wa(:), wds(:) INTEGER :: isf(2), nna(3) ! .. Executable Statements .. WRITE (nout,*) 'G13BDF Example Program Results' WRITE (nout,*) ! Skip heading in data file READ (nin,*) ! Read in problem size and cross-correlation at lag 0 READ (nin,*) nl, r0 ALLOCATE (r(nl)) ! Read in rest of cross-correlations READ (nin,*) r(1:nl) ! Read in transfer function model orders READ (nin,*) nna(1:3) ! Read in standard deviation ratio READ (nin,*) s nwds = nna(2) + nna(3) + 1 iwa = nna(3)*(nna(3)+1) ALLOCATE (wa(iwa),wds(nwds)) ! Calculate parameter estimates ifail = 0 CALL g13bdf(r0,r,nl,nna,s,nwds,wa,iwa,wds,isf,ifail) ! Display results WRITE (nout,99999) 'Success/failure indicator', isf(1), isf(2) WRITE (nout,*) WRITE (nout,99999) 'Transfer function model B, Q, P =', nna(1:3) WRITE (nout,*) WRITE (nout,*) 'Parameter initial estimates' WRITE (nout,99998) wds(1:nwds) 99999 FORMAT (1X,A,3I4) 99998 FORMAT (1X,4F10.4) END PROGRAM g13bdfe