advertisement

for\winv.for - for\Wfit.wpj SUBROUTINE WINV(DPASS,DFT,MC(JE,JB),IWf, IWfinv,Iwtinv) The arguments dpass and dft are equivalenced in the main program. The array DFT is filled with either the friequency or time domain information. These two arrays are also used as scratch space inside winv. Then FFT(dpass,.. ) is called to replace the current values in DFT by the appropriate Fourier sum. The terms JB and JE (not passed) are the beginning and ending Fourier coefficients in the fit, As shown below, only the sum MC=JE-JB+1 is needed by winv. The value Time is passed solely to allow frequencies to be output for plotting. IWf is the unit number where the input frequency values are stored. IWfinv is the unit number for the inverse frequency array. Iwtinv is the unit number for the time domain of this array (transformed over JE-JB+1 points). The code is designed to find an inverse to Wp such that (for details see Diagonal Matrices.doc). The test file for\AinvxWF.txt shows Wf as an array. Then Wfp as an array. Then is shows Wf-Wfp, and finally Wfinv (Wf-Wfp). These 2d arrays are based on 1d functions and are cheaper to recreate than to store. The periodic array The integers JB and JE are the beginning and ending regions of the fit. As will be shown below, only the sum MC=JEJB+1 is needed to define W, Wp, Wpinv, and Wp-1(W-Wp). JE W k mW m j m JB 1 p p k, j JB k , j JE (1) Define (2) MC JE JB 1 Then JB is frequently –MC/2, while JE = MC/2-1. Equation (1) corresponds to a matrix equation of the form 1 J B .J E J B , J B J B . J E 1 0 0 JB , JB 0 (3) 0 J , J J E , J E J B , J E J E , J E 0 0 1 B E The p refers to the fact that Fourier methods allow a simple unique solution for Wp-1[m] if (4) Wp m nM c Wp m When this is true, the operations in (1) are the same for all k and j or in (3) for each column and row. The minimum m in equations (1) and (3) occurs at the upper right of (3). m J B J E M C 1 (5) The maximum m value occurs at the lower left of (3). m JE JB MC 1 (6) Thus all values encountered in winv.for, are accounted for by defining Wp as W m M C m M C / 2 W p m W m M C / 2 m M C / 2 (7) W m M MC / 2 m C Note that if JB were 1000 and JE were 1003 that MC = 1003 -1000 +1 = 4 Then Wp[mmin] = Wp[1000-1003]=Wp[-3]=W[-3+2]=W[-1] Wp[mmin+1]=Wp[-2]=W[-2] … Wp[mmax-2]=Wp[1003-1000-2]=Wp[1]=W[1] Wp[mmax-1]=Wp[1003-1000-1]=Wp[2]=W[2-4]=W[-2] Wp[m max]=Wp[1003-1000]=Wp[3]=W[3-4]=W[-1] Note that the values that enter on the far left range from –MC/2 to MC/2 – 1, while the possible arguments range from -MC +1 to MC-1. To be specific, take as an example W[-3] = -1/3 W[-2]=-1/2 W[-1]=-1 W[0]=10 W[1]=1 W[2]=1/2 W[3]=1/3 So that the arrays Wn,m and Wp n,m become 10 1 1/ 2 1/ 3 1 10 1 1/ 2 W (8) 10 1 1/ 2 1 1/ 3 1/ 2 1 10 1 1/ 2 1 10 1 10 1 1/ 2 Wp (9) 1 10 1 1/ 2 1 1/ 2 1 10 The array W-Wp in this case is 0 0 0 4 / 3 0 0 0 0 W Wp (10) 1 0 0 0 4 / 3 1 0 0 The upper right corner is W[-3]-W[-1], while the lower left corner is W[3]-W[1]. In the limit of a very large array the 3 and 3 become –MC+1 and MC -1, which become very small. The -1 and 1, remain the same, however, for all size arrays. These are the subject of Periodic Array4.doc. The code for\winv.for calculates the matrix W-Wp, then multiplies it by Wp inverse and stores it in IWmWpf..