Program g13cbfe
! G13CBF Example Program Text
! Mark 30.1 Release. NAG Copyright 2024.
! .. Use Statements ..
Use nag_library, Only: g13cbf, nag_wp
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: pw, px
Integer :: i, ifail, kc, l, lg, lxg, mtx, mw, &
ng, nx
! .. Local Arrays ..
Real (Kind=nag_wp) :: stats(4)
Real (Kind=nag_wp), Allocatable :: xg(:)
! .. Intrinsic Procedures ..
Intrinsic :: max
! .. Executable Statements ..
Write (nout,*) 'G13CBF Example Program Results'
Write (nout,*)
! Skip heading in data file
Read (nin,*)
! Read in the problem size
Read (nin,*) nx
! Read in smoothing parameters
Read (nin,*) mtx, px, mw, l, kc, lg
If (mw/=nx) Then
Read (nin,*) pw
End If
lxg = max(kc,nx)
Allocate (xg(lxg))
! Read in series
Read (nin,*) xg(1:nx)
! Calculate smooth spectrum
ifail = -1
Call g13cbf(nx,mtx,px,mw,pw,l,kc,lg,xg,ng,stats,ifail)
If (ifail/=0) Then
If (ifail<4) Then
Go To 100
End If
End If
! Display results
If (mw==nx) Then
Write (nout,*) 'No smoothing'
Else
Write (nout,99999) 'Frequency width of smoothing window = 1/', mw
End If
Write (nout,99998) 'Degrees of freedom =', stats(1), &
' Bandwidth =', stats(4)
Write (nout,*)
Write (nout,99997) '95 percent confidence limits - Lower = ', &
stats(2), ' Upper = ', stats(3)
Write (nout,*)
Write (nout,*) &
' Spectrum Spectrum Spectrum Spectrum'
Write (nout,*) &
' estimate estimate estimate estimate'
Write (nout,99996)(i,xg(i),i=1,ng)
Write (nout,*)
100 Continue
99999 Format (1X,A,I0)
99998 Format (1X,A,F4.1,A,F7.4)
99997 Format (1X,A,F7.4,A,F7.4)
99996 Format (1X,I4,F10.4,I5,F10.4,I5,F10.4,I5,F10.4)
End Program g13cbfe