c c Code to visualize the sinc function in time and frequency domains c for MAST-811 Time Series Analysis c c Sept.-28, 2010 amue c real pi,x,y,t,dt,arg,y2,ymin2 pi = 4.*atan2(1.,1.) c c Record Length (Data Window or Filter Length) c T = 10. c c Time step in hours (if you wish) c dt = 0.25 c c number of data points c N = 800 c c find maximum of the first side-lobe c ymax = -999. ymax2 = -999. c c Run over all data points to get sinc function c do 1 i=1,N time = float(i-n/2)*dt frequency = time*0.01 arg = pi/T*time c c Special Case at t=0 or f=0 c if (arg .ne.0) then y = T*sin(arg)/arg else y = T end if arg2 = pi/T/2.*time if (arg2 .ne.0) then y2 = T/2*(sin(arg2)/arg2)*(sin(arg2)/arg2) else y2 = T/2 end if c write(7,*)time,sqrt(y*y),sqrt(y2*y2),frequency write(7,*)time,y,y2,frequency if (sqrt(y*y).gt.ymax .and. time.lt.-T) ymax = sqrt(y*y) if (sqrt(y2*y2).gt.ymax2 .and. time.lt.-T*2) ymax2 = sqrt(y2*y2) 1 continue c c Height of first side-lobe in db (decibels) c db = 20*log10(ymax/T) db2 = 20*log10(ymax2/(T/2)) write(6,*)'Amplitude a of first lobe: ',ymax, ' 20*log10(a/a0): ', db, ' decibel' write(6,*)'Amplitude a of first lobe: ',ymax2, ' 20*log10(a/a0): ', db2, ' decibel' stop end