LoginSignup
0
0

More than 5 years have passed since last update.

FIRフィルタの実装3 Circular Buffer

Posted at
// N : number of coefficients
// h(n) : filter coefficients, n = 0,…N-1
// x(n) : stored input data, n = 0,…2N-1
// input sample : variable that contains the newest input sample
// index : variable that contains the current place where the new sample is to be stored

x[index] = input_sample
// Filter the data
ynew = 0;
for (i=0;i<N;i++){
    if((index-i)<0){
        ynew = ynew + h[i]*x[index-i+N];
    } else {
        ynew = ynew + h[i]*x[index-i];
    }
}
index = (index+1)%N;


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0