1 subroutine fit3t(meas, nmeas, nquant, flag, nper, time, timdif,
45 #include "nav_cnst.fin"
47 integer*4 nmeas, nquant, nper
48 real*4 meas(nquant,nmeas), measout(nquant,nmeas*nper),
50 integer*4 iret, flag(nmeas),
52 real*8 time(nmeas*nper)
55 real*8 sumt, sumt2, sumt3, sumt4, sumt5, sumt6, summ(20),
56 1 summt(20), summt2(20), summt3(20), x(4), m(4,4), a(4)
57 real*8 newtim(maxlin), t, tp, tdiff, t1
59 integer*4 imeas, iquant, nsum
65 do imeas = 1, nmeas*nper
74 newtim(imeas) = time( (imeas - 1) * nper + 1 ) +
75 1 timdif(imeas) - time(1)
97 if (nsum.gt.0) tdiff = newtim(imeas) - tp
98 if( (flag(imeas) .eq. 0) .and. (tdiff .gt. 0.1) )
then
99 sumt = sumt + newtim(imeas)
100 sumt2 = sumt2 + newtim(imeas) * newtim(imeas)
101 sumt3 = sumt3 + newtim(imeas) **3
102 sumt4 = sumt4 + newtim(imeas) **4
103 sumt5 = sumt5 + newtim(imeas) **5
104 sumt6 = sumt6 + newtim(imeas) **6
108 do iquant = 1, nquant
109 summ(iquant) = summ(iquant) + meas(iquant,imeas)
110 summt(iquant) = summt(iquant) + meas(iquant,imeas) *
112 summt2(iquant) = summt2(iquant) + meas(iquant,imeas) *
113 1 newtim(imeas) * newtim(imeas)
114 summt3(iquant) = summt3(iquant) + meas(iquant,imeas) *
118 if (nsum .eq. 1) t1 = newtim(imeas)
154 x(3) = summt2(iquant)
155 x(4) = summt3(iquant)
163 if( iquant .eq. 1 )
then
164 call invert(m, x, 4, 4, a, iret )
167 tm3 = sqrt(m(4,4))*(tp - t1)**3
168 if (tm3 .gt. tolmat) iret = -1
174 if( iret .eq. 0 )
then
178 do imeas = 1, nmeas * nper
179 t = time(imeas) - time(1)
180 if ((t .ge. t1) .and. (t .le. tp))
then
181 measout(iquant,imeas) = a(1) + a(2) * t +
182 * a(3) * t * t + a(4) * t * t * t
187 print *,
' An error occured in the inversion process'
192 print *,
' Insufficient samples for smoothing'