【 MATLAB 】filter 函数介绍(一维数字滤波器)

在上篇博文中,里面有一个例子,就是过滤部分中的数据,这个部分中的数据的意思是如果有一个向量需要过滤,我们可以把它分为几段,然后分段过滤。

关于这个问题,使用语法:

[y,zf] = filter(___)

赋值符号左边的部分有一个y是过滤后的数据,那至于zf到底是个什么玩意,当时没有弄清楚,所以这里来专门讨论一番,参考MATLAB的参考文档的例子。

赋值符号右边的部分,可以是函数filter的语法中任何一种,即:

filter(b,a,x):对x进行滤波;

filter(b,a,x,zi):关于zi的解释,我们看下面这一段:


zi — Initial conditions for filter delays
[] (default) | vector | matrix | multidimensional array

Initial conditions for filter delays, specified as a vector, matrix, or multidimensional array.

滤波器延迟的初始条件,指定为矢量,矩阵或多维数组。

  • If zi is a vector, then its length must be max(length(a),length(b))-1.

  • If zi is a matrix or multidimensional array, then the size of the leading dimension must be max(length(a),length(b))-1. The size of each remaining dimension must match the size of the corresponding dimension of x. For example, consider using filter along the second dimension (dim = 2) of a 3-by-4-by-5 array x. The array zi must have size [max(length(a),length(b))-1]-by-3-by-5.

The default value, specified by [], initializes all filter delays to zero.

Data Types: double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical
Complex Number Support: Yes


对比zf,看看zf的解释:

zf — Final conditions for filter delays
vector | matrix | multidimensional array

Final conditions for filter delays, returned as a vector, matrix, or multidimensional array.

滤波器延迟的最终条件,作为矢量,矩阵或多维数组返回。

  • If x is a vector, then zf is a column vector of length max(length(a),length(b))-1.

  • If x is a matrix or multidimensional array, then zf is an array of column vectors of length max(length(a),length(b))-1, such that the number of columns in zf is equivalent to the number of columns in x. For example, consider using filter along the second dimension (dim = 2) of a 3-by-4-by-5 array x. The array zf has size [max(length(a),length(b))-1]-by-3-by-5.

Data Types: double | single


filter(b,a,x,zi,dim):dim是指定维度,如果x是一个矩阵,那么如果dim为1(默认值),那么就把对矩阵的每个列进行滤波,如果dim为2,则对矩阵的行进行滤波。


Filter Data in Sections

Use initial and final conditions for filter delays to filter data in sections, especially if memory limitations are a consideration.

Generate a large random data sequence and split it into two segments, x1 and x2.
x = randn(10000,1);

x1 = x(1:5000);
x2 = x(5001:end);
The whole sequence, x, is the vertical concatenation of x1 and x2.

Define the numerator and denominator coefficients for the rational transfer function,

b = [2,3];
a = [1,0.2];

Filter the subsequences x1 and x2 one at a time. Output the final conditions from filtering x1 to store the internal status of the filter at the end of the first segment.
[y1,zf] = filter(b,a,x1);

Use the final conditions from filtering x1 as initial conditions to filter the second segment, x2.
y2 = filter(b,a,x2,zf);
y1 is the filtered data from x1, and y2 is the filtered data from x2. The entire filtered sequence is the vertical concatenation of y1 and y2.

Filter the entire sequence simultaneously for comparison.
y = filter(b,a,x);

isequal(y,[y1;y2])


上面这个例子,验证了一种情况,就是如果对一个序列进行滤波,可以得到一个结果。

也可以通过另一种方式,就是把该序列分成两段,分段滤波,最后将滤波数据拼接起来,对比两种方式的最终结果,发现是一致的。

对第一段数据进行滤波时候会得到一个zf,这个zf作为第二段数据滤波时候的zi。

【 MATLAB 】filter 函数介绍 之 Filter Data in Sections相关推荐

  1. 【 MATLAB 】filter 函数介绍(一维数字滤波器)

    了解这个函数,先看看这个基础知识:[ MATLAB ]Rational Transfer Function(有理传递函数) filter 1-D digital filter Syntax y = f ...

  2. python filter函数_python基础——filter函数

    python基础--filter函数 Python内建的filter()函数用于过滤序列. 和map()类似,filter()也接收一个函数和一个序列.和map()不同的是,filter()把传入的函 ...

  3. R语言dplyr包filter函数 Error in filter(., ) : 找不到对象的报错原因和解决办法

    报错描述 当我们想使用dplyr包中的 filter 函数对指定的dataframe进行如下的行筛选时,R报错Error in filter(., ) : 找不到对象X.stage_id. ,提示我们 ...

  4. html中filter函数的用法,filter函数怎么使用

    JavaScript中的arr.filter()函数用于从给定数组创建一个新数组,该数组仅包含给定数组中满足参数函数设置条件的那些元素.下面我们就来具体看一下filter()的使用方法. filter ...

  5. 数字信号处理matlab卷积函数conv,filter函数详细介绍三秒钟就看懂。

    %x (n) =sin( pi*n/ 5),-10<= 10 (正弦离散函数) n1=-10:1:10; x1=sin(pi*n1/5); subplot(2,2,1); stem(n1,x1, ...

  6. matlab histeq cy源代码,matlab histeq函数介绍(示例代码)

    Histeq Enhance contrast using histogram equalization 该函数通过直方图均衡化来添加对照度 Syntax J = histeq(I,hgram) De ...

  7. matlab histequ,matlab histeq函数介绍

    Histeq Enhance contrast using histogram equalization 该函数通过直方图均衡化来增加对比度 Syntax J = histeq(I,hgram) De ...

  8. 【 MATLAB 】使用 filter 函数产生给定线性时不变系统的单位阶跃响应

    先给出filter的大致介绍:[ MATLAB ]filter 函数介绍(一维数字滤波器) 上篇博文写了产生一个系统的脉冲响应的博文,有兴趣可以看看:[ MATLAB ]使用 impz 函数计算并画出 ...

  9. lc filter在matlab哪,基于python实现matlab filter函数过程详解

    matlab中的filter函数: y = filter(b,a,x) python实现matlab中的filter函数 def filter_matlab(b,a,x): y = [] y.appe ...

最新文章

  1. 2022-2028年中国中密度纤维板市场投资分析及前景预测报告
  2. openstack 同一网络 多个subnet
  3. Java项目如何改成maven_普通java项目改进为maven:ecplise
  4. MySQL 可重复读,差点背上一个 P0 事故!
  5. 程序人生 Hello‘s P2P
  6. C++ priority_queue用法
  7. USB自定义HID设备实现-STM32
  8. 【多线程高并发】深入浅出volatile关键字
  9. HTML下拉菜单去掉点,jQuery点击页面其他部分隐藏下拉菜单功能
  10. Java设置软件图标即窗口上角图标
  11. C++ stringstream输入方式
  12. [leetcode]Generate Parentheses
  13. 一、Java 面向对象高级——Object类、常用API
  14. Zabbix监控Dell服务器主机和网络设备
  15. 基于物理的渲染详尽指南 卷1光与介质:基于物理的渲染和着色理论
  16. Chrome插件安装 程序包无效
  17. 易 捷文件共享Web服务器破解,局域网临时一键搭建网站或共享文件
  18. 网易云计算机系统有限公司,网易云音乐
  19. 【下载一】NI 系列软件卸载工具
  20. python调用qq互联_实现QQ互联一键登录代码教程

热门文章

  1. linux中文乱码怎么办
  2. gitee项目能用SVN拉取吗_用好 Git 和 SVN,轻松驾驭版本管理
  3. python比较excel表格内容并提取_python 实现excel数据的提取和整理
  4. c语言结构体如何定义字母,c语言中定义结构体如何定义?
  5. java异常_聊聊Java中的异常及处理
  6. java反序列化 exp_java反序列化-ysoserial-调试分析总结篇(4)
  7. android 获取网卡mac_在Android机顶盒上 怎么样获取有线网卡MAC地址?
  8. 常用的linux命令与示例,linux常用命令及用法示例
  9. java 获取第一帧_java获取视频的第一帧
  10. 飞机为什么能飞起来?直到今天,科学家仍然没有答案