If I have a simple low-pass filter, e.g.
filt = fir1(20, 0.2);
and a matrix with a list of numbers (a signal), e.g. [0.1, -0.2,开发者_高级运维 0.3, -0.4] etc, how do I actually apply the filter I've created to this signal?
Seems like a simple question but I've been stuck for hours. Do I need to manually calculate it from the filter coefficients?
Here you go:
filter(filt, 1, mysignal);
will do the trick. Since this is an FIR filter, the A parameter (the second parameter) is set to 1.
The filter function is what you need.
I believe help filter or doc filter will get you on your way.
Here you cant give a value which is grater than 1 for the first argument of fir1 function. It should be between 0 and 1. Let's say cutoff frequency is Fc and sampling frequency is Fs, then if we take Wn as the first argument which is the cutoff frequency as a normalized value. This is how Wn should be calculated.
     Wn = (2/Fs)*Fc
Then you can apply filter function like below:
      filt = fir1(Wn , 0.2);
      filter(filt, 1, mysignal);
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论