function prepareDAPPM() global DAPPM_A global DAPPM_L global DAPPM_LIM global rDAPPM global rinf A=DAPPM_A; L=DAPPM_L; L1=L+1; amean=(1+A)*0.5 density=2.0/(L+1) aaverage=amean*density rinf=aaverage*aaverage %Amplitude square average: rDAPPM(1)=(A+1)*(2*A+1)/3.0/L1; L1Power=1; LPower=1; %Calculate chip correlation: for k=1:L L1Power=L1Power*L1; LPower=LPower*L; mu=1.0*L1Power/LPower/L1; rDAPPM(k+1)= rinf * mu / density; end %Summarize probabilities for correlation at distance k>L: for k=L1:DAPPM_LIM sum=0.0; for j=k-L:k-1 sum=sum+rDAPPM(j+1); end %Take average: rDAPPM(k+1)=sum/L; end end Copyright (C) 2009 Konstantin Kirillov