Median and Mode Calculator v1.0

The Median and Mode Calculator block calculates the median and the mode from the input data stream over a configurable time window and sample set size. This block performs a subset of the processing performed by the Data Distribution Calculator block. Consequently, execution of this block is slightly faster than execution of the Data Distribution Calculator block. Like the Correlation Calculation block, the set of samples may be unlimited in size, or constrained by a maximum number of samples or a maximum age of samples.

Parameters

Parameter | Description |

period | The maximum age of any sample that is used in the calculations, in seconds. Any samples older than this will be discarded before performing the calculation. |

size | The maximum number of samples that are used in the calculation. The oldest sample is replaced by the newest sample when the total number of samples has reached this limit. |

One or both of the above parameters must be 0, in which case that limit is not imposed. It is not possible to restrict the number of samples by both age and number of samples, but it is possible to not impose any limit on the number of samples (thus an infinite set of samples is kept).

Operations

Operation | Description |

start | Starts the calculation of statistics. Must be called before the calculator will generate any statistics. |

stop | Stops the calculation of further statistics. Any subsequent input feeds are ignored. |

clear | Discards all current data. |

Input feeds

Feed | Fields | Description |

data | value | The feed of values. The time of a value is taken to be the correlator's current time. |

Output feeds

Feed | Fields | Description |

statistics | value | The most recent value received on the input feed |

mode | The most commonly occurring value, if there is one. | |

no unique mode | true if there is no single mode. | |

median | The mid point of the ordered set of data values. | |

samples | The number of samples used for this calculation. |