#!/bin/csh -f
cat >! prog.f << EOF
      program sinedata
c     calculate sine & cosine data 
c      for testing "Fourier series expansion"
c					Sep. 06, 1995
c				updated:Apr. 18, 2002
      parameter(nobs=360,nk=6)
      parameter(pi=3.1415926535)
      real dat(nk,0:nobs),total(0:nobs)

c +++ open output file
      open(51,file='sin.dat')
c     pi=4.0*atan(1.0)

      coef=pi/180.0
      do iobs=1,nobs
        dat(1,iobs)=2+ 3.0*sin( (     iobs)*coef )	! k=0&1
        dat(2,iobs)=   3.0*cos( ( 2.0*iobs)*coef )	! k=2
     &               + 4.0*sin( ( 2.0*iobs)*coef )	! k=2
        dat(3,iobs)=  -5.0*sin( ( 3.0*iobs)*coef )	! k=3
        dat(4,iobs)=   2.0*sin( ( 5.0*iobs)*coef )	! k=5
        dat(5,iobs)=   2.0*cos( (15.0*iobs)*coef )	! k=15
        dat(6,iobs)=   1.0*sin( (60.0*iobs)*coef )	! k=60

c +++ summention of all wave components
        do ik=1,nk
          total(iobs)=total(iobs)+dat(ik,iobs)
        enddo	! iwave

c +++ output: each wave component & total component
        write(51,5110) iobs,real(iobs)*coef,total(iobs),
     &        (dat(j,iobs),j=1,nk)
c +++ output: total component only!
cc      write(51,5100) iobs,real(iobs)*coef,total(iobs)

      enddo	! iobs

c     print *,sin(pi/2)
 5110 format(i4,f8.4,7f8.3)
 5100 format(i4,f8.4,f8.3)

      stop
      end
EOF
frt prog.f	# "Fortran & C package V2 for Linux", copyright: Fujitsu Kyushu System Engineering Ltd.
  ./a.out
#
\rm -f a.out prog.f
exit
