    

advertisement
Periodic Array
The fundamental equations are in ..\..\Fittery\Complex\WeightedFourierFit\Weighted Fourier Fit.doc equation
(28) These become
ME
 W  n  m  P n  X m  R n
m, n
m M B
MB  n  ME
(1)
(2)
MC  M E  M B  1
Note that MB is frequently less than 0, e.g MB = -Mc/2 and ME = Mc/2-1.
MB  n  ME
 W n

W p  n   W  n  M 
n  ME
(3)
 W n  M 
n  MB

Sample set of numbers - This section is coded into winv.for which is called from
Wfit.wpj.
The code is described in ..\..\Fittery\Complex\WeightedFourierFit\WfitCode.doc
This is for 3107 pts with err = 1e-5, w=1e10, centered in 4096 points with a beginning 494 points with w=0 and an ending
495 with w=0.
>WFIT -B-2 -E1
The periodic array in one dimension
Frequency
Real Wp
Imag Wp
-0.669110E-01 -0.650957E+13 -0.199712E+11
-0.334555E-01 -0.896845E+13 -0.137574E+11
0.000000E+00 0.310700E+14 0.000000E+00
0.334555E-01 -0.896845E+13 0.137574E+11
The two d version
Af mat
0.311E+14 0.000E+00
-0.897E+13-0.138E+11
-0.651E+13-0.200E+11
-0.897E+13 0.138E+11
-0.897E+13 0.138E+11
0.311E+14 0.000E+00
-0.897E+13-0.138E+11
-0.651E+13-0.200E+11
-0.651E+13-0.200E+11
-0.897E+13 0.138E+11
0.311E+14 0.000E+00
-0.897E+13-0.138E+11
-0.897E+13-0.138E+11
-0.651E+13-0.200E+11
-0.897E+13 0.138E+11
0.311E+14 0.000E+00
ALMf mat
0.000E+00 0.000E+00
0.000E+00 0.000E+00
0.000E+00 0.000E+00
0.566E+13-0.290E+11
0.000E+00 0.000E+00
0.000E+00 0.000E+00
0.000E+00 0.000E+00
0.000E+00 0.000E+00
0.000E+00 0.399E+11
0.000E+00 0.000E+00
0.000E+00 0.000E+00
0.000E+00 0.000E+00
0.566E+13 0.290E+11
0.000E+00 0.399E+11
0.000E+00 0.000E+00
0.000E+00 0.000E+00
Afinv mat
0.569E-13 0.109E-15
0.319E-13 0.121E-15
0.303E-13 0.124E-15
0.319E-13 0.101E-15
0.319E-13 0.101E-15
0.569E-13 0.109E-15
0.319E-13 0.121E-15
0.303E-13 0.124E-15
0.303E-13 0.124E-15
0.319E-13 0.101E-15
0.569E-13 0.109E-15
0.319E-13 0.121E-15
0.319E-13 0.121E-15
0.303E-13 0.124E-15
0.319E-13 0.101E-15
0.569E-13 0.109E-15
ME
ME
 W  n  m  X  m   W  n  m   P n
m M B
p
m M B
winv.for
Multiply by Wp-1(k-n) and sum on n
n ,m
 Wp  n  m   X  m   R  n  M B  n  M E (4)
ME
ME
 
mM B n M B
Wp1  k  n W p  n  m X  m  
ME

m M B
ME
X m
ME
 W  k  n  W  n  m   P n 
n M B
1
p
 W  k  n  R n
nM B
1
p
m.n
 Wp  n  m  
(5)
MB  n  ME
Define
X p k  
ME
 W  k  n  R  n
nM B
1
p
(6)
And
Aˆ LM  k , m 
ME
 W  k  n  W  n  m   P n
nM B
1
p
n ,m
 Wp  n  m   M B  k  m (7)
WpINV * (Wf+1d100-4,m -Wp)
J
-4
-3
-2
-1
0
1
2
3
R 0.746E+86-0.560E+00-0.604E+00-0.592E+00-0.525E+00-0.341E+00-0.215E+00-0.181E+00
I 0.481E+83 0.793E-03 0.320E-03-0.255E-03-0.594E-03-0.561E-03-0.206E-04 0.615E-03
J
R
I
-4
-3
-2
-1
0
1
2
3
0.746E+86-0.300E+00-0.340E+00-0.349E+00-0.313E+00-0.270E+00-0.120E+00-0.241E-01
0.481E+83 0.606E-03 0.407E-03 0.453E-04-0.260E-03-0.310E-03-0.175E-03 0.248E-03
J
R
I
-4
-3
-2
-1
0
1
2
3
0.746E+86-0.103E+00-0.119E+00-0.130E+00-0.119E+00-0.103E+00-0.886E-01 0.365E-01
0.481E+83 0.272E-03 0.235E-03 0.119E-03-0.253E-04-0.871E-04-0.450E-04 0.307E-06
J
R
I
-4
-3
-2
-1
0
1
2
3
0.746E+86 0.000E+00 0.000E+00 0.000E+00 0.000E+00 0.000E+00 0.000E+00 0.000E+00
0.481E+83 0.000E+00 0.000E+00 0.000E+00 0.000E+00 0.000E+00 0.000E+00 0.000E+00
J
R
I
-4
-3
-2
-1
0
1
2
3
0.746E+86-0.133E-06-0.181E-06-0.140E-06-0.319E-07 0.883E-07 0.134E-06 0.888E-07
0.481E+83-0.777E-04-0.900E-04-0.104E-03-0.114E-03-0.104E-03-0.900E-04-0.777E-04
J
R
I
-4
-3
-2
-1
0
1
2
3
0.746E+86-0.886E-01-0.103E+00-0.119E+00-0.130E+00-0.119E+00-0.103E+00-0.886E-01
0.481E+83 0.127E-03 0.639E-04-0.603E-05-0.150E-03-0.290E-03-0.322E-03-0.248E-03
J
R
I
-4
-3
-2
-1
0
1
2
3
0.746E+86-0.120E+00-0.270E+00-0.313E+00-0.349E+00-0.340E+00-0.300E+00-0.260E+00
0.481E+83 0.233E-03 0.488E-03 0.340E-03 0.523E-04-0.334E-03-0.565E-03-0.505E-03
J
R
I
-4
-3
-2
-1
0
1
2
3
0.746E+86-0.215E+00-0.341E+00-0.525E+00-0.592E+00-0.604E+00-0.560E+00-0.491E+00
0.481E+83 0.171E-03 0.735E-03 0.898E-03 0.493E-03-0.968E-04-0.603E-03-0.732E-03
The Penalty term above makes X-4 0. The other X’s are still normal. The effect of the other X’s on this is not
different for the -1 row with all other values 0. This effectively removes the first value of X from the solution
vector. With X1 = 0, the other values can be found.
The exact evaluation of A cannot be done by convolution owing to the fact that it is not periodic.
winv.for
To find
X k  
ME
 X  m Aˆ k , m  X k 
m M B
LM
p
(8)
Or adding a 1 to the diagonal elements of ALM, so that
ALM  k , m   k ,m 
ME
 W  k  n  W  n  m   P n
nM B
1
p
m,n
 Wp  n  m  
(9)
Or
ALM  k , m   k ,m  W
1
p
ME
 k  m  P m   Wp1  k  n  W  n  m   Wp  n  m   (10)
nM B
To correspond to ..\..\Fittery\Complex\WeightedFourierFit\WeightedFourierFit.doc the n and m are intechanged
ALM  k , n   k , n  W
1
p
ME
 k  n  P  n   Wp1  k  m  W  m  n   Wp  m  n  
mM B
The penalty comes in for |n|  MB or ME. This is tied to the other values by Wp-1.
J
-16
-15
-14
-13
-12
-11
-10
-9
J
-8
-7
-6
-5
-4
-3
-2
-1
J
0
1
2
3
4
5
6
7
J
8
9
10
11
12
13
14
15
R 0.704E+30 0.263E+24 0.316E+19 0.830E+14 0.475E+10 0.594E+06 0.162E+03 0.106E+00
R 0.934E-02 0.919E-02 0.918E-02 0.917E-02 0.918E-02 0.919E-02 0.922E-02 0.926E-02
R 0.932E-02 0.105E-01 0.118E-01 0.130E-01 0.142E-01 0.153E-01 0.165E-01 0.176E-01
R 0.188E-01 0.116E+00 0.162E+03 0.594E+06 0.475E+10 0.830E+14 0.316E+19 0.263E+24
I 0.439E+26 0.319E+21 0.474E+16 0.147E+12 0.972E+07 0.137E+04 0.414E+00-0.773E-04
I -0.349E-03-0.353E-03-0.357E-03-0.362E-03-0.368E-03-0.374E-03-0.381E-03-0.388E-03
I -0.395E-03-0.845E-03-0.840E-03-0.833E-03-0.824E-03-0.811E-03-0.796E-03-0.779E-03
I -0.759E-03-0.822E-03-0.108E+00-0.251E+03-0.825E+06 0.707E+10 0.112E+16 0.166E+21
So that (8) becomes
ME

mM B
ALM  k , m X  m  X p  k 
(11)
In the crudest approximation, ALM [k , n]  W p1  0 P  n   1  k , n
This implies that after Xp has been found, that it can be made into X, by
Do m=MB,ME
X[m]=Xp[m]/(Wp-1[0]*P[m]+1)
Enddo
In a better approximation the ends are tied together while the middle is left out
Rearrange the k,s as MB,ME,MB+1,ME-1,...,ME-(L-1),MB+L. This forms a 2L+1 element array,
that can be solved for the appropriate X's.
Iteration
X it  k   X p  k  
M / 2 1
M / 2 1
 
m  M / 2 n  M / 2
Wp1  k  n  W  n  m   W p  n  m  X it 1  m 
(12)
For each value of m, the terms in the sum are different. The sum over W p is a convolution, but not the sum over W.
For Wp-1(k-n)=k,n/W(0)
X it  k   X p  k  
1 M / 2 1
 W  k  m   Wp  k  m   X it 1 m
W  0  m  M / 2
Note that for -M/2k-m<M/2 that the term in parenthesis is zero. Or
M/2+k  m > -M/2+k. The sum is not zero for m-M/2+k and for m >M/2+k
(13)
 k M / 2

W  k  m   W p  k  m   X it 1  m 




1  m  M / 2

X it  k   X p  k  
 M / 2 1
 (14)
W  0 

W  k  m   Wp  k  m   X it 1  m
 m  M
/ 2  k 1

1
1
Wk , n 
 Wn , m  W1,2
W1,2
  S k .m S1.2



 
1
S 2,1
 W2,1
  W2,1



 





 


 


 









For k=-M/2, the first term is from -M/2 to -M or zero. The second term is from m=1 to M/2-1. For k=M/2-1, the first term is from M/2 to -1, and the second term is zero. There is a sum of ~ M/4 terms for each k, so that the time requires is M 2/4. To evaluate for the
L terms in each corner requires 2*L*L/2 or L2 operations.
Start with Xp
X 2 k   X p k   
X 3 k   X p k   

1
M / 2 1
 W  k  m   W  k  m   X m
W  0  m  M / 2
1
p
p
M / 2 1
 W  k  m   W  k  m   X m
W  0  m  M / 2
p
M / 2 1
(15)
p
M / 2 1
 W  k  m   W  k  m    W  k  m '  W  k  m '  X m
1
W 2  0  m  M / 2
p
p
m '  M / 2
p
This converges as 1/W[0], 1/(W[0])2 etc. The convergence works as long as the W difference is < W(0) which in our case is almost a
given.
Evaluation of Xp
The equation for Xp is a convolution. #Xp
X p k  
ME
 W  k  n  R  n
nM B
1
p
(16)
..\..\Fourier\DiscreteConvolution.doc htm (1.4)
MC  M E  M B  1
X p k  
ME

nM B
R  nWp1  k  n  
1
MC
ME

ki
 r i  w i  exp  j 2 M
i M B
1
p

C
 (17)


The sum, with the usual problem of locations, is returned by FFT. ..\..\Fittery\Complex\WeightedFourierFit\for\Wfit.wpj
Download