Skip to content

Commit

Permalink
Avoid matrix math in computing initial step state for SOS
Browse files Browse the repository at this point in the history
  • Loading branch information
simonster committed Apr 22, 2015
1 parent 01c3655 commit e89c702
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Filters/filt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,10 @@ function filt_stepstate{T}(f::SecondOrderSections{T})
si = Array(T, 2, length(biquads))
for i = 1:length(biquads)
biquad = biquads[i]
A = [one(T)+biquad.a1 -one(T)
+biquad.a2 one(T)]
B = [biquad.b1 - biquad.a1*biquad.b0,
biquad.b2 - biquad.a2*biquad.b0]
si[:, i] = A \ B
si[1, i] = (-(biquad.a1 + biquad.a2)*biquad.b0 + biquad.b1 + biquad.b2)/
(biquad.a1 + biquad.a2 + 1)
si[2, i] = (biquad.a1*biquad.b2 - biquad.a2*(biquad.b0 + biquad.b1) + biquad.b2)/
(biquad.a1 + biquad.a2 + 1)
end
si[1, 1] *= f.g
si[2, 1] *= f.g
Expand Down

0 comments on commit e89c702

Please sign in to comment.