Changeset 242 for trunk/SRC/ToBeReviewed/STATISTICS/c_timecorrelate.pro
- Timestamp:
- 04/06/07 10:35:17 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ToBeReviewed/STATISTICS/c_timecorrelate.pro
r232 r242 8 8 ; @param XD 9 9 ; 10 ;11 10 ; @param YD 12 11 ; 13 ;14 12 ; @param M 15 13 ; 16 ;17 14 ; @param NT 18 15 ; 19 ;20 16 ; @param NDIM 21 17 ; 22 ;23 18 ; @keyword ZERO2NAN 24 ;25 19 ; 26 20 ; @keyword DOUBLE … … 30 24 ; @examples 31 25 ; 32 ;33 26 ; @history 34 ;35 27 ; 36 28 ; @version … … 38 30 ; 39 31 ;- 32 ; 40 33 FUNCTION timecross_cov, Xd, Yd, M, nT, Ndim, Double = Double, ZERO2NAN = zero2nan 41 ;Sample cross covariance function. 42 34 ; 43 35 compile_opt hidden 44 36 ; 37 ;Sample cross covariance function. 45 38 case Ndim OF 46 39 1:res = TOTAL(Xd[0:nT - M - 1L] * Yd[M:nT - 1L] $ … … 61 54 62 55 END 56 ; 63 57 ;+ 58 ; 64 59 ; @file_comments 65 60 ; This function computes the "time cross correlation" Pxy(L) or … … 71 66 ; Statistics 72 67 ; 73 ; @param X {in}{required} {type=array}74 ; An Array which last dimension is the time dimension of68 ; @param X {in}{required} {type=array} 69 ; An array which last dimension is the time dimension of 75 70 ; size n, float or double. 76 71 ; 77 ; @param Y {in}{required} {type=array}78 ; An Array which last dimension is the time dimension of72 ; @param Y {in}{required} {type=array} 73 ; An array which last dimension is the time dimension of 79 74 ; size n, float or double. 80 75 ; 81 76 ; @param LAG {in}{required}{type=scalar or vector} 82 ; A scalar or n-element vector, in the interval [-(n-2),(n-2)],77 ; A scalar or n-elements vector, in the interval [-(n-2),(n-2)], 83 78 ; of type integer that specifies the absolute distance(s) between 84 79 ; indexed elements of X. … … 94 89 ; @examples 95 90 ; 96 ; Define two n-elementsample populations.97 ; 98 ; 99 ; 100 ; 101 ; 102 ; 103 ; 104 ; 105 ; 91 ; Define two n-elements sample populations. 92 ; IDL> x = [3.73, 3.67, 3.77, 3.83, 4.67, 5.87, 6.70, 6.97, 6.40, 5.57] 93 ; IDL> y = [2.31, 2.76, 3.02, 3.13, 3.72, 3.88, 3.97, 4.39, 4.34, 3.95] 94 ; 95 ; Compute the cross correlation of X and Y for LAG = -5, 0, 1, 5, 6, 7 96 ; IDL> lag = [-5, 0, 1, 5, 6, 7] 97 ; IDL> result = c_timecorrelate(x, y, lag) 98 ; 99 ; The result should be: 100 ; [-0.428246, 0.914755, 0.674547, -0.405140, -0.403100, -0.339685] 106 101 ; 107 102 ; @history … … 120 115 ; 121 116 ;- 117 ; 122 118 FUNCTION c_timecorrelate, X, Y, Lag, Covariance = Covariance, Double = Double 119 ; 123 120 124 121 ;Compute the sample cross correlation or cross covariance of … … 133 130 134 131 if total(xsize[0:xsize[0]] NE ysize[0:ysize[0]]) NE 0 then $ 135 MESSAGE, "X and Y arrays must have the same size and the same dimensions"132 ras = report("X and Y arrays must have the same size and the same dimensions") 136 133 137 134 ;Check length. 138 135 if nt lt 2 then $ 139 MESSAGE, "Time dimension of X and Y arrays must contain 2 or more elements."136 ras = report("Time dimension of X and Y arrays must contain 2 or more elements.") 140 137 141 138 ;If the DOUBLE keyword is not set then the internal precision and … … 210 207 211 208 END 212
Note: See TracChangeset
for help on using the changeset viewer.