Filtering and Analysis Functions

Filtering

Function Description

fftfilt

Filters a signal with a digitalFilter using an FFT-based overlap-add method

filter

Filters a signal using a digitalFilter

filtfilt

Performs zero-phase filtering of a signal with a digitalFilter

Filter Analysis

Function Description

double

Casts the coefficients of a digitalFilter to double precision

filt2block

Generates a Simulink® filter block corresponding to a digitalFilter

filtord

Returns the filter order of a digitalFilter

firtype

Returns the type (1, 2, 3, or 4) of an FIR digitalFilter

freqz

Returns or plots the frequency response of a digitalFilter

fvtool

Opens the Filter Visualization Tool and displays the magnitude response of a digitalFilter

grpdelay

Returns or plots the group delay response of a digitalFilter

impz

Returns or plots the impulse response of a digitalFilter

impzlength

Returns the length of the impulse response of a digitalFilter, whether actual (for FIR filters) or effective (for IIR filters)

info

Returns a character array with information about a digitalFilter

isallpass

Returns true if a digitalFilter is allpass

isdouble

Returns true if the coefficients of a digitalFilter are double precision

isfir

Returns true if a digitalFilter has a finite impulse response

islinphase

Returns true if a digitalFilter has linear phase

ismaxphase

Returns true if a digitalFilter is maximum phase

isminphase

Returns true if a digitalFilter is minimum phase

issingle

Returns true if the coefficients of a digitalFilter are single precision

isstable

Returns true if a digitalFilter is stable

phasedelay

Returns or plots the phase delay response of a digitalFilter

phasez

Returns or plots the (unwrapped) phase response of a digitalFilter

single

Casts the coefficients of a digitalFilter to single precision

ss

Returns the state-space representation of a digitalFilter

stepz

Returns or plots the step response of a digitalFilter

tf

Returns the transfer function representation of a digitalFilter

zerophase

Returns or plots the zero-phase response of a digitalFilter

zpk

Returns the zero-pole-gain representation of a digitalFilter

zplane

Displays the poles and zeros of the transfer function represented by a digitalFilter

1.zero,pole-->transfer function form

[b,a] = zp2tf(zer,pol,1);
fvtool(b,a)

2.transform function-->zero/polo

fvtool(b,a,'Analysis','polezero')

zplane(b,a)

3.Z-transform frequency response of a digital filter.

[h,w] = freqz(b,a,p)

returns the p-point complex frequency response, H(ejω), of the digital filter.

For example, a ninth-order Butterworth lowpass filter with a cutoff frequency of 400 Hz, based on a 2000 Hz sampling frequency, is

[b,a] = butter(9,400/1000);

To calculate the 256-point complex frequency response for this filter, and plot the magnitude and phase with freqz, use

freqz(b,a,256,2000)

4.filter

Use filter in the form y = filter(d,x) to filter an input signal, x, with a digitalFilterd, and obtain output data, y.

5.designfilt(https://ww2.mathworks.cn/help/signal/ref/designfilt.html)

Use designfilt in the form d = designfilt(resp,Name,Value) to design a digital filter, d, with response type resp. Specify the filter further using a set of Name,Value pairs.

Type d.Coefficients to obtain the coefficients of a digitalFilterd. For IIR filters, the coefficients are expressed as second-order sections.

Lowpass IIR Filter

Design a lowpass IIR filter with order 8, passband frequency 35 kHz, and passband ripple 0.2 dB. Specify a sample rate of 200 kHz. Visualize the magnitude response of the filter. Use it to filter a 1000-sample random signal.

lpFilt = designfilt('lowpassiir','FilterOrder',8, ...
'PassbandFrequency',35e3,'PassbandRipple',0.2, ...
'SampleRate',200e3);
fvtool(lpFilt)

dataIn = randn(1000,1);
dataOut = filter(lpFilt,dataIn);

Output the filter coefficients, expressed as second-order sections.

sos = lpFilt.Coefficients
sos = 4×6

    0.2666    0.5333    0.2666    1.0000   -0.8346    0.9073
0.1943 0.3886 0.1943 1.0000 -0.9586 0.7403
0.1012 0.2023 0.1012 1.0000 -1.1912 0.5983
0.0318 0.0636 0.0318 1.0000 -1.3810 0.5090

Bandpass FIR Filter

Design a 20th-order bandpass FIR filter with lower cutoff frequency 500 Hz and higher cutoff frequency 560 Hz. The sample rate is 1500 Hz. Visualize the magnitude response of the filter. Use it to filter a random signal containing 1000 samples.

bpFilt = designfilt('bandpassfir','FilterOrder',20, ...
'CutoffFrequency1',500,'CutoffFrequency2',560, ...
'SampleRate',1500);
fvtool(bpFilt)

dataIn = randn(1000,1);
dataOut = filter(bpFilt,dataIn);

Output the filter coefficients.

b = bpFilt.Coefficients
b = 1×21

   -0.0113    0.0067    0.0125   -0.0445    0.0504    0.0101   -0.1070    0.1407   -0.0464   -0.1127    0.1913   -0.1127   -0.0464    0.1407   -0.1070    0.0101    0.0504   -0.0445    0.0125    0.0067   -0.0113 ⋯

6.fvtool

fvtool(b,a)
fvtool(sos)
fvtool(d)
fvtool(b1,a1,b2,a2,...,bN,aN)
fvtool(sos1,sos2,...,sosN)
fvtool(Hd)
fvtool(Hd1,Hd2,...,HdN)
h = fvtool(...)

Use fvtool to visualize a digitalFilterd.

Matlab filter常用函数的更多相关文章

  1. MATLAB中常用函数及语法

    zeros() 1 zeros(n):n*n 全零矩阵 2 zeros(m,n):m*n全零矩阵 3 zeros(d1,d2,d3……dn):生成 d1*d2*d3*……*dn 全零矩阵或数组. 4 ...

  2. matlab 图像常用函数

    Canny function [ canny ] = canny( rgb ) temp=rgb2gray(rgb); canny=edge(temp,'canny'); end 灰度 temp=rg ...

  3. 【Matlab】常用函数

    1.取整函数 ceil(x)返回不小于x的最小整数值.floor(x)返回不大于x的最大整数值.round(x)返回x的四舍五入整数值.

  4. Matlab GUI设计中的一些常用函数

    Matlab GUI常用函数总结 % — 文件的打开.读取和关闭% — 文件的保存% — 创建一个进度条% — 在名为display的axes显示图像,然后关闭% — 把数字转化为时间格式% — ch ...

  5. matlab进阶:常用功能的实现,常用函数的说明

    常用功能的实现 获取当前脚本所在目录 current_script_dir = fileparts(mfilename('fullpath')); % 结尾不带'/' 常用函数的说明 bsxfun m ...

  6. matlab 常用函数

    Matlab常用函数 Matlab的内部常数  eps   浮点相对精度  pi  圆周率  exp  自然对数的底数e  i 或j  虚数单位  Inf或 inf  无穷大 Matlab概率密度函数 ...

  7. Matlab常用函数集锦

    ndims(A)返回A的维数size(A)返回A各个维的最大元素个数length(A)返回max(size(A))[m,n]=size(A)如果A是二维数组,返回行数和列数nnz(A)返回A中非0元素 ...

  8. MATLAB算术运算符和常用函数

    1 算术运算符 Matlab中的算术运算符按优先级由高到低为: (1) ^           幂 (2) *            乘      /            右除(正常除)       ...

  9. MATLAB常用函数

      Matlab的内部常数 pi                   圆周率 exp(1)             自然对数的底数e i 或j                虚数单位 Inf或 inf ...

随机推荐

  1. PTA L2-029 | 特立独行的幸福 (打表+递归)

    题目描述 对一个十进制数的各位数字做一次平方和,称作一次迭代.如果一个十进制数能通过若干次迭代得到 \(1\),就称该数为幸福数.\(1\) 是一个幸福数.此外,例如 \(19\) 经过一次迭代得到 ...

  2. mybatis入门案例2

    1. 笔记:1.配置了typeAlias之后,在其他需要写com.itheima.domain.User的地方都可以用user代替 2.先用properties指定了jdbcConfig.proper ...

  3. PAT (Basic Level) Practice (中文)1038 统计同成绩学生 (20 分)

    本题要求读入 N 名学生的成绩,将获得某一给定分数的学生人数输出. 输入格式: 输入在第 1 行给出不超过 1 的正整数 N,即学生总人数.随后一行给出 N 名学生的百分制整数成绩,中间以空格分隔.最 ...

  4. 洛谷P1402 酒店之王(网络流)

    ### 洛谷P1402 题目链接 ### 题目大意:有 n 个人, p 间房间,q 种食物.每个人喜欢一些房间,一些食物,但每间房间.每种食物只能分配给一个人.问最大可以让多少个人满足(当且仅当分配到 ...

  5. P5048 [[Ynoi2019模拟赛]Yuno loves sqrt technology III]

    为什么我感觉这题难度虚高啊-- 区间众数的出现次数- 计算器算一下 \(\sqrt 500000 = 708\) 然后我们发现这题的突破口? 考虑分块出来[L,R]块的众数出现个数 用 \(\text ...

  6. mysql 服务

    1.以管理员身份运行cmd:C:\Windows\System32\cmd.exe  右键以管理员身份运行 2.“具体路径” --install   “D:\programme installatio ...

  7. TODO:rds数据库实例

    rds数据库实例怎么创建的 rds数据库实例高可用是怎么实现的 rds备份是怎么实现的 参考: https://www.cnblogs.com/jackyzzy/p/7384355.html http ...

  8. DataGrid 的DataSource重新加载数据

    DataGrid 的DataSource重新加载数据,若直接重新给DataSource赋值是没有效果的,若只是修改原有数据中的单个值,此方法有效,但是针对完全不一样的数据直接重新赋值的方式是无效的,此 ...

  9. Laravel通过用户名和密码查询

    一.如果要检查要验证的用户数据是否正确,可以使用: if (Auth::validate($credentials)) { // } 二.但是如果您想通过用户和密码从数据库中获取用户,您可以使用: / ...

  10. mysql5.6创建账户不能本地登录

    1.通过xshell连接linux,命令登录mysql 2.创建一个新的库(其实创建不创建都可以) 3.创建账号权限 创建账号luffy 密码luffy 针对库luffy所有权限,允许任何人远程登录 ...