Moving Average: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Category:Block Docs Computes a moving average of the input: Output[i] = scale * sum(input[i-length: i]) In its default parameters, the block actually computes a moving...") |
m (→Parameters) |
||
Line 12: | Line 12: | ||
: Complex, Float, Int or Short | : Complex, Float, Int or Short | ||
; Length | ; Length (''Interactive'') | ||
: The size of the moving average window to use. Can be changed at runtime. | : The size of the moving average window to use. Can be changed at runtime. | ||
; Scale | ; Scale (''Interactive'') | ||
: Factor to scale the sum of the last (Length) samples. To get an actual moving average, the scale should then be set to 1/Length. Can be changed at runtime. | : Factor to scale the sum of the last (Length) samples. To get an actual moving average, the scale should then be set to 1/Length. Can be changed at runtime. | ||
Line 26: | Line 26: | ||
: When operating on vectors, the average is done using only the numbers from the same vector index: | : When operating on vectors, the average is done using only the numbers from the same vector index: | ||
: Output[i][vector_index] = scale * sum(Input[i-length: i][vector_index]) | : Output[i][vector_index] = scale * sum(Input[i-length: i][vector_index]) | ||
== Example Flowgraph == | == Example Flowgraph == |
Revision as of 09:45, 11 July 2019
Computes a moving average of the input:
Output[i] = scale * sum(input[i-length: i])
In its default parameters, the block actually computes a moving sum.
Parameters
- Input Type
- Complex, Float, Int or Short
- Length (Interactive)
- The size of the moving average window to use. Can be changed at runtime.
- Scale (Interactive)
- Factor to scale the sum of the last (Length) samples. To get an actual moving average, the scale should then be set to 1/Length. Can be changed at runtime.
- Max Iter
- The maximum number of samples the block will treat in one call of its work function. Larger numbers can improve throughput at the cost of latency and potential numerical instability with float or complex input.
- Max Iter can be smaller than Length without issues.
- vlen
- Used if the input samples are vectors and corresponds to the length of those vectors.
- When operating on vectors, the average is done using only the numbers from the same vector index:
- Output[i][vector_index] = scale * sum(Input[i-length: i][vector_index])
Example Flowgraph
Source Files
- C++ files
- All inputs
- Header files
- All inputs
- Public header files
- All inputs
- Block definition
- GRC yaml