Variance ExampleΒΆ

group VarianceExample

Refer riscv_variance_example_f32.c

Description:

Demonstrates the use of Basic Math and Support Functions to calculate the variance of an input sequence with N samples. Uniformly distributed white noise is taken as input.

Algorithm:

The variance of a sequence is the mean of the squared deviation of the sequence from its mean.

This is denoted by the following equation: where, x[n] is the input sequence, N is the number of input samples, and x' is the mean value of the input sequence, x[n].

The mean value x' is defined as:

Block Diagram:

../../../_images/Variance.png

Variables Description:

  • testInput_f32 points to the input data

  • wire1, wir2, wire3 temporary buffers

  • blockSize number of samples processed at a time

  • refVarianceOut reference variance value

NMSIS DSP Software Library Functions Used:

  • riscv_dot_prod_f32()

  • riscv_mult_f32()

  • riscv_sub_f32()

  • riscv_fill_f32()

  • riscv_copy_f32()