If lag is 2 and n is 10, lead will be 8 meaning the output vector will have 8 NaNs at the start, and 2 at the end. The weights used are also returned for reference in the output weights.įirst lead is calculated from the lag and n values. The weights should either be a vector of length the average window ( n), or a string that matches any of the examples in side the function ( 'exp', 'symExp', 'linInc', or 'rand'). MovAv2 takes 4 inputs the data to be averaged (vector, y), the number of points over which to perform the average (scaler, n), the lag (scaler, lag) of the output vector relative to the input vector, and a vector of weights to use ( weights). ![]() The absolute values of the weights are unimportant, as they're normalised to relative values that sum to 1 in the script.įunction = movAv2(y,n,lag,weights) Weights can also be supplied as a vector the same length as the average window ( n). ![]() Weights - Included are a few random weights as examples in the script as examples, although the only one that might be useful is 'simExp', which exponentially weights the values in the centre of the average window higher than the outer points.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |