How to apply a low-pass or high-pass filter to an array in Matlab?

后端 未结 2 1917
[愿得一人]
[愿得一人] 2020-12-01 10:57

Is there an easy way to apply a low-pass or high-pass filter to an array in MATLAB? I\'m a bit overwhelmed by MATLAB\'s power (or the complexity of mathematics?) and need an

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 11:17

    Look at the filter function.

    If you just need a 1-pole low-pass filter, it's

    xfilt = filter(a, [1 a-1], x);
    

    where a = T/τ, T = the time between samples, and τ (tau) is the filter time constant.

    Here's the corresponding high-pass filter:

    xfilt = filter([1-a a-1],[1 a-1], x);
    

    If you need to design a filter, and have a license for the Signal Processing Toolbox, there's a bunch of functions, look at fvtool and fdatool.

提交回复
热议问题