simple examples of filter function, recursive option specifically

前端 未结 4 1759
走了就别回头了
走了就别回头了 2020-12-02 15:36

I am seeking some simple (i.e. - no maths notation, long-form reproducible code) examples for the filter function in R I think I have my head around the convolu

4条回答
  •  囚心锁ツ
    2020-12-02 16:17

    In the recursive case, I think no need to expand the expression in terms of xi. The key with "recursive" is to express the right hand expression in terms of previous y's.

    I prefer thinking in terms of filter size.

    filter size =1

    y1 <- x1                                            
    y2 <- x2 + f1*y1      
    y3 <- x3 + f1*y2 
    y4 <- x4 + f1*y3 
    y5 <- x5 + f1*y4 
    

    filter size = 2

    y1 <- x1                                            
    y2 <- x2 + f1*y1      
    y3 <- x3 + f1*y2 + f2*y1    # apply the filter for the past value and add current input
    y4 <- x4 + f1*y3 + f2*y2
    y5 <- x5 + f1*y4 + f2*y3
    

提交回复
热议问题