|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| Resonant Lowpass Filter Soruce |
|
![]() Anonymous Poster |
||||
|
||||
| Hi, My name is Cristina,I'm Spanish,and I need to program a Low Pass filter in C language and I'm lost! I saw your piece of program in internet, "Resonant low pass filter source code" and I dont understand how the history array is used. If we only have 1 section, n=1, and the algorithm is: y(n)=K*x(n)+b1*x(n-1)+b2*x(n-2)-a1*y(n-1)-a2*y(n-2) I understand that: output = input * (*coef_ptr++); //means: y(n)=K*x(n) output = output - history1 * (*coef_ptr++); //means: y(n)=K*x(n)-a1*y(n-1) new_hist = output - history2 * (*coef_ptr++); //means: new_hist=K*x(n)-a1*y(n-1)-a2*y(n-2) output = new_hist + history1 * (*coef_ptr++); // y(n)=K*x(n)-a1*y(n-1)-a2*y(n-2)+b1*y(n-1) output = output + history2 * (*coef_ptr++); //y(n)=K*x(n)-a1*y(n-1)-a2*y(n-2)+b1*y(n-1)+b2*y(n-2) So I dont understand the last two lines of the code, because I dont find here the history array for the inputs. And if I call the function iir_filter with an empty array for the variable *history (and I work with n=1).............the function only will return: output=K*input, so I dont understand how it does the iir filtering. If you know which my mistakes are, plese tell me! Thank you VERY MUCH! Cris |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|