1 c===========================================================================
3 c This file is part of TISEAN
5 c Copyright (c) 1998-2007 Rainer Hegger, Holger Kantz, Thomas Schreiber
7 c TISEAN is free software; you can redistribute it and/or modify
8 c it under the terms of the GNU General Public License as published by
9 c the Free Software Foundation; either version 2 of the License, or
10 c (at your option) any later version.
12 c TISEAN is distributed in the hope that it will be useful,
13 c but WITHOUT ANY WARRANTY; without even the implied warranty of
14 c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 c GNU General Public License for more details.
17 c You should have received a copy of the GNU General Public License
18 c along with TISEAN; if not, write to the Free Software
19 c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 c===========================================================================
23 c iterate AR model, e.g. as fitted by ar-model (Dresden)
24 c author T. Schreiber (1999)
25 c===========================================================================
28 character*72 file, fout, fline
29 dimension x(-npmax:npmax), a(npmax)
31 data np/npmax/, ntrans/10000/, iuni/0/
34 call whatido("iterate AR model, e.g. as fitted by ar-model",iverb)
36 if(np.gt.npmax) stop "ar-run: make npmax larger."
38 ntrans=ican("x",ntrans)
39 if(lopt("u",1).eq.1) iuni=1
40 r=rand(sqrt(abs(fcan("I",0.0))))
41 isout=igetout(fout,iverb)
46 call nthstring(1,file)
47 call infile(file,iunit,iverb)
48 read(iunit,'(a)') fline
49 if(fline(1:1).eq."#") then
50 read(fline(18:72),'(f20.0)',err=999) var
52 read(iunit,'(a1,f20.0)',err=999) fline(1:1), a(j)
53 20 if(fline(1:1).ne."#") goto 1
55 read(fline(1:72),'(f20.0)',err=999) var
57 30 read(iunit,'(f20.0)',err=999,end=1) a(j)
60 if(iv_echo(iverb).eq.1) then
61 write(istderr(),*) 'coefficients: ', (a(i),i=1,np)
62 write(istderr(),*) 'driving amplitude: ', var
64 if(isout.eq.1) fout="ar.dat"
65 call outfile(fout,iunit,iverb)
76 if(nmax.eq.0.or.n.lt.nmax) goto 2
79 999 write(istderr(),'(a)') "wrong input format! try:"
80 write(istderr(),'(a)') "(rms of increments)"
81 write(istderr(),'(a)') "a(1)"
82 write(istderr(),'(a)') "a(2)"
83 write(istderr(),'(a)') "..."
90 . "-l# [-p# -I# -o outfile -x# -V# -h] file")
91 call popt("l","number of iterations (l=0: infinite)")
92 call popt("p","order of AR-model (default determined from input)")
93 call popt("I","seed for random numbers")
94 call popt("x","number of transients discarded (10000)")