FIR

Mehmet Ozan Ünal edited this page Feb 8, 2017 · 4 revisions
Clone this wiki locally

Theory

detailed info

Arduino example

FIR is filter structure which keep delays and coeficient of filter. filtFIR function require 2 arguments. data data lenght Do not forget to add #include "simpleDSP_fir.h"

  init(&fir1, 46, coef);
  Serial.print("Initiliaze finished");
  

  for(int i = 0; i<255; i++)
  {
    startTime = millis();
    float a ;
    a = filt(&fir1,input[i]); 
    calcTime = millis()-startTime;
    Serial.println("%f",a);
    Serial.print("Total calculation time: ");
    Serial.println(calcTime);
  }

Performance of implementation

Arduino Nano

  • fir filter 10 coeficients: 190 us
  • fir filter 23 coeficients: 453 us
  • fir filter 46 coeficients: 900 us

for 10 coeficients implementation max frequency 5khz

Octave Code

filter design

output of fir functions can be used as filter coeficients

resource

Examples:

 freqz (fir1 (40, 0.3));
 freqz (fir1 (15, [0.2, 0.5], "stop"));  # note the zero-crossing at 0.1
 freqz (fir1 (15, [0.2, 0.5], "stop", "noscale"));

filter frequency response

function reference fir1

Output from octave

input

inputa

input FFT

inputf

output

output

output signal fft

outputf