Private Sub ArrayInterpolation( ByRef arr() As Double)ĭim FirstMissingItem As Integer = 0 For Current As Integer = arr.GetLowerBound( 0) To arr.GetUpperBound( 0) Maybe somebody else can provide you some code for that. You take the existing values that are next to those that are missing (in the example, 8 and 4) and imagine a linear increase/decrease between them. ' Set start and end indizes (keep array bounds in mind) ' Create an array with the same size as the given one Dim ret(UBound(arr)) As Double ' The indizes between which the values will be averaged change with each iteration Dim FromIndex, ToIndex As Integer ' Buffer for average calculation changes with each iteration Dim TempAvg As Double ' Iterate through every element in the given array For i As Integer = 0 To UBound(arr) Public Function CalcMovAvg( ByVal arr As Double(), ByVal Range As Byte) As Double() ''' The number of previous and following values to average to the resulting value. ''' ''' The array to use for calculation. ''' ''' Calculates the moving average with the given range over the given array and returns the result.
0 Comments
Leave a Reply. |