Skip to content

Commit

Permalink
Fix start values of FIIR and Biquad filter to second sample
Browse files Browse the repository at this point in the history
  • Loading branch information
theHenks committed Dec 15, 2024
1 parent b48c598 commit d8f52c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/biquad_filter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ end
s1 = fma(neg_a1, y_i, z2)
s2 = fma(neg_a2, y_i, z3)
end

# fix start value
Y[1] = Y[2]

Y
end

Expand Down
4 changes: 4 additions & 0 deletions src/first_order_iir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ X::AbstractVector{U}) where {T<:Real, U<:Real}

s1 = fma(neg_a1, y_i, z2)
end

# fix start value
Y[1] = Y[2]

Y
end

Expand Down

0 comments on commit d8f52c9

Please sign in to comment.