In Matlab the filter
is a function
that enables convert a LCCDE in time domain to a computable
function. That is, for array and , input signal , compute so that the relation below hold.
As a Functional/Array programmer, it is not difficult to discover the data dependency and get
and the fact that can be parallelized. |comp_b=. [+/@:*(-@i.@#@[) |.!.0"0 1]
The actual y
is dependent on the previous
n-1
results. This gives the relation to be used by
fold (F..
):
|a_1=.{.a
|a_n=.}.a
|fn=.],~a_1%~[-a_n+/@:*(#a_n){.]
Finally, assemble all together gives:
|filter =: {{
|'a b'=.m
|comp_b=. [+/@:*(-@i.@#@[) |.!.0"0 1]
|
|a_1=.{.a
|a_n=.}.a
|fn=.],~a_1%~[-a_n+/@:*(#a_n){.]
|(0$0) |.F..fn b comp_b y
|}}
Bibliography
[filter] 1-D digital filter. Mathworks. https://www.mathworks.com/help/matlab/ref/filter.html.
[nuvoc] NuVoc. J Wiki. https://code.jsoftware.com/wiki/NuVoc.