Apply a digital filter (direct form II transposed): Difference between revisions

Content added Content deleted
m (→‎version 1: changed some comments and whitespace.)
Line 740: Line 740:
do i=1 for N /*process each of the vector elements. */
do i=1 for N /*process each of the vector elements. */
#=0 /*temp variable used in calculations. */
#=0 /*temp variable used in calculations. */
do j=1 for words(@b) /*process all of the B coefficients. */
do j=1 for words(@b); if i-j >= 0 then #= # + word(@b, j) * word(@s, i-j+1)
if i-j >= 0 then #=# + word(@b, j) * word(@s, i-j+1)
end /*j*/ /* [↑] process all the B coefficients.*/
end /*j*/


do k=1 for words(@a); _=i-k+1 /*process all of the A coefficients. */
do k=1 for words(@a); _=i - k + 1; if i-k >= 0 then #=# - word(@a, k) * $._
if i-k >= 0 then #=# - word(@a, k) * $._
end /*k*/ /* [↑] process all the A coefficients.*/
end /*k*/
$.i= # / word(@a ,1); call tell /*only display using half the dec digs.*/
$.i=#/word(@a ,1); call tell /*only display using half the dec digs.*/
end /*i*/
end /*i*/
exit /*stick a fork in it, we're all done. */
exit /*stick a fork in it, we're all done. */