FilterDesignwiththeFDAToolGUI璇星

ThissectiondescribeshowtographicallydesignandimplementdigitalfiltersusingtheSignalProcessingToolboxFDAToolGUI.Filterdesignistheprocessofcreatingthefiltercoefficientstomeetspecificfrequencyspecifications.Filterimplementationinvolveschoosingandapplyingaparticularfilterstructuretothosecoefficients.Onlyafterbothdesignandimplementationhavebeenperformedcanyourdatabefiltered.

本章描述了怎样利用信号处理工具箱(FDAToolGUI)图解设计和执行数字滤波器。滤波器的设计是一个为满足频率要求创建滤波器系数的过程。滤波器的执行是利用这些滤波器系数选择和应用一个特殊的滤波器结构。只有在设计和执行完成之后才可以将你的数据进行滤波。

ThissectionincludesabriefdiscussionofapplyingthecompletedfilterdesignandfilterimplementationusingMATLABcommandlinefunctions,suchasfilter.

本章包括完全的利用MatlabCommandLine函数(例如filter)对滤波器进行设计和执行的简要论述。

ForaninteractiveFDATooldemo,typedemosattheMATLABcommandline,andselectToolboxes.Expandthetree,scrolldown,andselectSignalProcessingToolbox.UnderFilterDesignandAnalysis,clickIntroductiontoFilterDesignandAnalysisTool.

针对一个交互式FDATool演示,在MatlabCMDLine中键入demos然后选择Toolboxes。展开树,向下滚屏选择信号处理工具箱。在滤波器设计和分析中单击IntroductiontoFilterDesignandAnalysisTool。

Thissectionisastep-by-stepintroductiontousingtheFilterDesignandAnalysisTool(FDATool)todesignanoctave-bandfilter.Anoctaveistheintervalbetweentwofrequencieshavingaratioof2:1.Anoctave-bandfilterisabandpassfilterwithhighcutofffrequencyapproximatelytwicethatofthelowcutofffrequency.Theclassofanoctavefilterisdeterminedbyitsallowablepassbandrippleanditsstopbandattenuation.RefertotheANSIS1.11–2004standardformoreinformation.Formoreinformationondesigningfilters,seeFDATool:AFilterDesignandAnalysisGUIintheSignalProcessingToolboxUser'sGuide.(NotethatyoucanalsoaccessFDAToolfromSPTool).

这一部分按部就班的介绍应用FDATool设计一个倍频滤波器。倍频是指两个频率中间的比例为2:1。倍频滤波器是一个在通带的高频截止频率大约是低频截止频率两倍的滤波器。倍频滤波器的种类是由允许的通带波纹和阻带衰减决定的。滤波器设计的更多信息,见FDATool:AFilterDesignandAnalysisGUIintheSignalProcessingToolboxUser’sGuide.(注意:由SPTool也可以访问FDATool)。

Fdatool

TheFDATooldialogopenswithadefaultfilter.Itsfilterinformationissummarizedintheupperleft(CurrentFilterInformation)anditsfilterspecificationsaredepictedintheupperright.Inadditiontodisplayingfilterspecification,thisupperrightpanedisplaysfilterresponsesandfiltercoefficients.

FDATool对话框打开默认滤波器。这个滤波器的信息的概述位于左上角(CurrentFilterInformation),设计规则显示在右上角。右上角除了能显示滤波器设计规则,还可以显示滤波器响应和滤波器系数。

ThebottomhalfofFDAToolshowstheFilterDesignpanel,whereyouspecifythefilterparameters.Otherpanels,suchasImportfilterfromworkspaceandPole/ZeroEditor,whichyouaccesswiththebuttonsonthelowerleft,arealsodisplayedinthisarea.Ifyouhaveotherproductsinstalled,youmayseeadditionalbuttons.

在FDAToo的底部显示了滤波器设计面板,你可以在这里指定滤波器参数。其他的面板,例如可以在左下部访问的按钮:由workspace导入和零极点Pole/Zero编辑器也在这个区域显示。如果你安装其他的产品,你也许可以看到其他的按钮。

在响应类型ResponseType面板中,选择带通Bandpass按钮。

在设计方法DesignMethod面板中,选择IIR,然后选择Butterworth形式。

在滤波器阶数面板中,选择指定阶数,输入6.

设置频率规则如下:

Parameter

Setting

Description

Units

Hz

Unitsfortheparameters参数单位

Fs

48000

Samplingfrequency%采样频率

Fc1

22

Firstcutofffrequency(i.e.,thefrequencyprecedingthepassbandatwhichthemagnituderesponseis3dBbelowthepassbandgain)

第一个截止频率(例如通带前面的相对通带衰减3dB时的频率)

Fc2

45

Secondcutofffrequency(i.e.,thefrequencyfollowingthepassbandatwhichthemagnituderesponseis3dBbelowthepassbandgain)

第二个截止频率(例如通带之后的相对通带衰减3dB时的频率)

指定滤波器参数之后,点击在设计面板下面的设计滤波器DesignFilter按钮计算滤波器系数。设计的滤波器的幅值响应将会显示出来。

NoticethattheDesignFilterbuttonisdisabledafteryoucomputethecoefficientsforyourfilterdesign.Thisbuttonisenabledagainifyoumakeanychangestothefilterspecifications.

注意设计滤波器DesignFilter按钮在计算滤波器系数之后是不可用的。当你改变任何滤波器规则时这个按钮将会再次开启。

点击保存滤波器按钮

在保存滤波器对话框,将滤波器名称该为Butterworth-1然后点击OK保存滤波器在滤波器管理器中。

Afterdesigningthefilter,youcanviewthefollowingfilterresponsesinthedisplayregionbyclickingontheassociatedtoolbarbuttonorbyselectingthedesiredresponsefromtheAnalysismenu.

滤波器设计完成后,你可以通过点击联合工具条或在Analysis菜单下选择期望的响应观察如下滤波器的响应。

Response响应

ToolbarButtonImage

Magnituderesponse幅值响应

Phaseresponse相位响应

MagnitudeandPhaseresponses幅值和相位响应

Groupdelay群延迟

Phasedelay相角延迟

Impulseresponse脉冲响应

Stepresponse阶跃响应

Pole-zeroplot零极点图

Filtercoefficients滤波器系数

Filterinformation滤波器信息

Zero-phaseresponse–onlyavailablefromacontextmenu.Right-clickonthey-axisofaMagnitudeorMagnitudeandPhaseresponseplotorselectAnalysis>AnalysisParameters.

零相位响应——只存在于上下文菜单中。右击幅值或幅值和相位响应图的y轴或选择Analysis>AnalysisParameters:

NoteOtheranalysesareavailableifyouhavetheFilterDesignToolboxproductinstalled.

注意如果你已经安装了FilterDesignToolbox就会存在其他的分析。

1.Examinethedisplayedmagnituderesponseofthefilter.

检查显示的滤波器的幅频特性

2.Displayotherresponses,asdesired.Clicktheappropriatebuttons,showninthetableaboveorselectthedesiredresponsefromtheAnalysismenu.

显示其他期望的响应。点击显示于上表中合适的按钮或在Analysis菜单中选择期望的响应。

3.ClicktheFiltercoefficientsbuttontodisplaythefiltercoefficients.

Youhavedesignedoneofthebandsofanoctavefilterbank.Thissectionshowsyouhowtodesignandsavetheotherninebands.Thefollowingtabledefinestheparametersfortheremainingbands.Notethatallofthebandsusetheseparameters:Bandpass,IIR–Butterworth,order=6,Fs=48000Hz.

你已经设计了一个倍频滤波器。这一部分向你展示如何设计和保存其他9个频段。下面的表格定义了剩下频段的参数。注意所有的频段都用这个参数:BandPass,IIR-Butterworth,order=6,Fs=48000Hz。

FilterName

89

BandpassButterworth-2

178

BandpassButterworth-3

355

BandpassButterworth-4

708

BandpassButterworth-5

1413

BandpassButterworth-6

2818

BandpassButterworth-7

5623

BandpassButterworth-8

11220

BandpassButterworth-9

22387

BandpassButterworth-10

1.Usingtheparameterslistedinthetableabove,foreachtablerow,settheappropriatetheFc1andFc2values.

用在上表中的参数的每一行设置合适的Fc1和Fc2值。

2.DesignthefilterbyclickingtheDesignFilterbutton.

点击DesignFilter按钮设计滤波器。

3.ClickStoreFiltertosavethefilter.

点击StoreFilter保存滤波器

4.Changethenametotheappropriatefilternameshowninthetableabove.

给滤波器命名为上表中合适的名字

5.Repeatthesestepsuntilall10filtersaredesignedandstored.

重复这些步骤直到10个滤波器全部设计完成和存储

ThissectionteachesyouhowtousetheFilterVisualizationTool(FVTool)toviewtheoctave-bandfilter.Italsodescribeshowtoannotateyourfilter.

这一部分教你如何利用滤波器可视化工具(FVTool)去观察倍频滤波器。其中也描述了怎样注释你的滤波器。

1.ClicktheFilterManagerbuttontodisplaytheFilterManager,whichlistsyoursavedfilters.

点击FilterManager按钮去显示滤波器管理器,管理器中列出了你保存的滤波器。

2.PressCtrl+clickoneachfilternametoselectallthefilters,andthenclickFVTool.FVToolopenswiththefilterresponsesoverlaidforeasycomparison.(IfyouwanttoviewasinglefilterinFVTool,clicktheFullViewAnalysisbuttonwhenthatfilterisshownintheFDATooldisplaypanelorselectView>FilterVisualizationTool).

点击Ctrl+Click每个滤波器的名字选择所有的滤波器,然后点击FVTool。FVTool为了方便比较以覆盖模式打开滤波器响应。(如果你想用FVTool查看一个滤波器,当滤波器已经显示在FDATool面板时点击FullViewAnalysis按钮或选择View->FilterVisualizationTool).

3.Changethex-axisscaletologarithmicbyselectingAnalysis>AnalysisParameterstodisplaytheAnalysisParametersdialog.

通过选择Analysis>AnalysisParameters来显示分析参数对话框去改变x轴刻度为对数坐标。

4.ChangetheFrequencyScaletoLog.

改变频率刻度为log。

5.ClickOK.

点击OK

点击图例按钮开启图例功能,你可以拖放到想要的位置。

7.ClicktheLegendbuttonagaintoturnoffthelegend.

再次点击Legend按钮可以关闭图例。

利用Zoom按钮拖放一个方框在前几个通带去放大图像。

点击恢复默认视图按钮返回全景视图。

9.Displayotherresponses,asdesired.(TheFVToolAnalysistoolbarbuttonsandAnalysismenuarethesameasinFDATool.SeeAnalyzingtheFilterfordescriptionsofthebuttons.

按照需要显示其他响应。(FVTool分析工具按钮和Analysis菜单在FDATool中是一样的。按钮的描述见AnalysistheFilter)

FVToolisalsousefulfordoingfurtheranalysis,addingannotations,andprinting.Availableannotationsincludeaddingrectangles,textboxes,arrowsandlines,andaddingdatatips.

FVTool对深入分析是有用的,添加注释然后打印。可用的注释包括添加矩形,文本框,箭头和直线,添加数据标签。

ForademoaboutFVTool,typedemosattheMATLABcommandline,andselectToolboxes.Expandthetree,scrolldown,andselectSignalProcessingToolbox.UnderFilterDesignandAnalysis,clickFilterAnalysisusingFVToolanditsAPI.

在MATLAB的CMD中键入demos选择Tooboxes,展开树,滚动到SignalProcessingToolbox并选中来打开对FVTool的演示。在FilterDesignandAnalysis下点击FilterAnalysisusingFVToolanditsAPI。

1.Usethetoolbarbuttonstoannotateyourresponseplot.Addalinebyclickingoneofthelinebuttons,andthenuseyourmousetodrawthelineonyourplot.

利用工具栏按钮去注释你的响应图形。通过点击直线按钮中的一个去添加一条直线,然后利用你的鼠标在你的图像中画出直线。

2.Addadatatipbyclickingonaplotatthedesiredpoint.Thedatatipshowsthefrequencyandmagnitudeatthatpoint.

3.CloseFVToolbyselectingFile>Close.

通过选择File>Close关闭FVTool。

FDAToolprovidesasimplewaytocreatefilterobjects(dfilts)fromyourfilterdesigns.ThisisparticularlyusefulforsavingyourfilterdesigntotheMATLABworkspaceforusewithcommandlinefunctions.YoucanalsosaveyourfilterstoM-filesusingFile>GenerateM-filetoruninscriptsorbatchfiles.

FDATool提供了一种由你的滤波器设计创建滤波器对象(dfilts)的简单方法。这在你保存你的滤波器设计到MATLABworkspace并用于命令行函数时是非常有用的。你可以利用using>GenerateM-file保存你的滤波器为M文件然后在脚本或批处理中运行。

1.InFDATool,clickFilterManagerandhighlightonlytheBandpassButterworth-1filter.

在FDATool中,点击FilterManager然后高亮BandpassButterworth-1滤波器。

2.SelectFile>Export.

选择File>Export.

3.SetExporttotoWorkspace.SetExportastoObjects.InDiscreteFiltertypeHd1.ClickExporttoexportthefirstfilterinyourfilterbanktoanHd1dfiltobjectintheworkspace.

4.Repeatsteps1through3foreachoftheremainingninefilters.HighlighteachfilterindividuallytomakeittheactivefilterandchangetheDiscreteFilternametomatchthefilternumber.Whenyoufinishyouwillhave10dfiltobjectsintheworkspace.

为剩余9个滤波器重复步骤1到3。高亮每个滤波器为当前滤波器并改变离散滤波器的名字匹配滤波器序号。完成后你将由10个dfilt对象在工作空间中。

5.CloseFDAToolbyselectingFile>Close.

通过选择File>Close关闭FDATool。

6.OntheMATLABcommandline,verifythatyourobjectswereexportedbyusingthewhoscommand.

在MatlabCMDLine中通过whos命令核实你所导出的对象。

whosNameSizeBytesClassAttributesHd11x1dfilt.df2sosHd101x1dfilt.df2sosHd21x1dfilt.df2sosHd31x1dfilt.df2sosHd41x1dfilt.df2sosHd51x1dfilt.df2sosHd61x1dfilt.df2sosHd71x1dfilt.df2sosHd81x1dfilt.df2sosHd91x1dfilt.df2sos

1.TypethefollowingontheMATLABcommandlinetoconcatenateyourfilterbankfilterobjectsintoasingledfiltobject.

在CMD中键入如下命令使你的滤波器组对象成为单独的滤波器对象。

Hd=[Hd1Hd2Hd3Hd4Hd5Hd6Hd7Hd8Hd9Hd10];

2.Toviewthefirstfilter,typeHd(1).

查看第一个滤波器,键入Hd(1)

Hd(1)ans=FilterStructure:'Direct-FormII,Second-OrderSections'sosMatrix:[3x6double]ScaleValues:[3.40097054256801e-009;1;1;1]PersistentMemory:false

3.AnumberofmethodscanbeusedtoviewandmanipulatetheHd1dfiltobject.Trytheinfocommand:

由许多的方法能够用于查看和处理Hdldfilt对象。可以试着info命令。

info(Hd1)%DisplaysfilterinformationDiscrete-TimeIIRFilter(real)-------------------------------FilterStructure:Direct-FormII,Second-OrderSectionsNumberofSections:3Stable:YesLinearPhase:No

4.YoucanopenFVToolfromtheMATLABcommandlineandspecifydisplayparametersasfollows.

你可以由MATLABCMD打开FVTool然后像如下指定显示的参数.

F=fvtool(Hd,'Analysis','magnitude')%OpenFVToolwith%magnitudedisplayset(F,'FrequencyScale','Log')%Changetologscale

Thisproducesthesamedisplayasstep5ofViewingtheFilterinFVToolabove.

5.NowusingtheMATLABcommandline,createsomediscretewhiteGaussiannoisedata,whichyoucanthenfilterusingthefilterbank.

现在利用MatlabCMDline创建一些离散的高斯白噪声数据,这样你可以用滤波器组进行滤波。

rand;%InitializerandomnumbergeneratorNx=100000;%Numberofnoisedatapointsxw=randn(Nx,1);%Createwhitenoisefori=1:10,yw(:,i)=filter(Hd(i),xw);%Filterthewhitenoisethroughend%theentirefilterbank.%(:,i)meansallrowsofcolumni

6.Plotthefiltereddata.

plot(yw)

Thenextsectiondiscussesspectralanalysis,whereyouanalyzethisdata.

下一节将讨论频谱分析来分析这些数据。

BeginningwithR2009a,userscanspecifyanddesignfiltersatthecommandlineusingfdesignanddesign.Theuseoffdesignanddesignprovidesapowerfulandefficientwaytospecifyandimplementdigitalfilters.Withfdesignanddesign,digitalfilterdesignisatwo-stepprocess.Inthefirststep,theuserspecifiesthedesiredcharacteristicsofthefilterandsavesthosespecificationsinaFilterSpecificationObject.Inthesecondstep,theuserimplementsthefilterasadfiltobject,whichcanthenbeusedtofilterdata.Asanexampleofthistwo-stepprocess,wewilldesignalowpassfilterfordatasampledat20kHz.Thedesiredpassbandfrequencyis1kHzwithastopbandfrequencyof1.2kHz.Wewilllimitthepassbandrippleto1dBandrequire60dBofattenuationbetweenthepassbandandstopbandfrequencies.

由2009a开始,用户可以在CMD中利用fdesign和design函数指定和设计滤波器。fdesign和design的利用提供了一种强大和高效的方法去指定和运行数字滤波器。利用fdesign和design设计数字滤波器是一个两步的过程。第一步,用户指定滤波器的期望特性,保存这些指标在一个滤波器指标对象中。第二步,用户将滤波器作为dfilt对象进行处理,这可以别用于滤波器数据。例如:我们将要设计一个低通滤波器,数据采样频率为20kHz。期望的通带频率为1kHz阻带频率为1.2kHz。我们将限制通带波纹为1dB,阻带衰减为60dB。

1.Tospecifythefilterusefdesign.lowpasswiththeparametersgivenabove.YoucancopyandpastethefollowingcodeattheMATLABcommandprompt.

利用fdesign.lowpass指定以上参数,你可以拷贝然后粘贴如下代码在MATLABCMD中。

d=fdesign.lowpass('Fp,Fst,Ap,Ast',1000,1200,1,60,20000);

2.Todesignthefilterusedesignwiththeappropriatedesignmethods.Inthisexample,wecreateFIRequirippleandIIRButterworthdesignsandcomparethefilters'magnituderesponses.

利用design和合适的设计方法设计滤波器。在这个例子中,我们创建FIR线性相位滤波器和IIR巴特沃兹滤波器设计然后比较滤波器的幅值响应。

Hd1=design(d,'equiripple');%FIRequirippledesignHd2=design(d,'butter');%ButterworthdesignHd=[Hd1Hd2];%filterobjectwithbothdesigns%comparefiltersfvtool(Hd,'legend','on');axis([02-7010])

TodeterminewhichfilterdesignmethodsareavailableforagivenFilterSpecificationObject,usedesignmethods.Forthelowpassfilterexampleabove,youhaveachoiceoftwoFIRandfourIIRdigitalfilterdesigns.:

利用designmethods去决定对于给定的滤波器设计对象存在什么滤波器设计方法。对于上面的例子提及的低通滤波器,你可以选择两种FIR和四种IIR数字滤波器进行设计。

THE END
1.提升数据处理效率:WRAPROWS功能解析了解WRAPROWS如何将一维数据高效转化为二维数据格式,优化您的数据分析流程,提高工作效率。https://www.kdocs.cn/article/CD4D947401.html
2.extract用法ayayaselect extract(year from sysdate) from dual 函数用于从日期时间中取得所需的特定数据(年份,月份和天)https://www.iteye.com/blog/ayaya-134736
3.苏州上海Simulink信号处理培训班目标:熟练掌握使用命令行和SPTool图形用户界面来创建信号 创建和输入信号 采样和重新采样 显示信号 对噪声建模 信号的统计特性和相关 谱分析 目标:理解统计信号处理. 研究使用谱分析的方法在时域和频域显示并分析信号. 离散傅立叶变换 窗和频谱 功率谱密度估计 ...http://q.51qianru.cn/m/Matlabsimulinxinhaochulipeixun.htm
4.SignalAnalysis用法.pdf该【SignalAnalysis用法】是由【鼠标】上传分享,文档一共【4】页,该文档可以免费在线阅读,需要了解更多关于【SignalAnalysis用法】的内容,可以使用淘豆网的站内搜索功能,选择自己适合的文档,以下文字是截取该文章内的部分文字,如需要获得完整电子版,请下载此文档到您的设备,方便您编辑和打印。Signal?Analysi使s用?1.?https://www.taodocs.com/p-927867254.html
1.stp文件怎么打开(stp文件怎么打开看)大家好,小丽今天来为大家解答stp文件怎么打开以下问题,stp文件怎么打开看很多人还不知道,现在让我们一起来看看吧!1、 CAD软件:STP文件是CAD软件中的标准文件格式之一,许多CAD软件都能打开...https://www.indoasiabiz.com/jiankang/202411/310253350.html
2.huTool工具类常用方法DateUtil: 日期时间工具类,定义了一些常用的日期时间操作方法。 //Date、long、Calendar之间的相互转换 //当前时间 Datedate=DateUtil.date(); //Calendar转Date date=DateUtil.date(Calendar.getInstance()); //时间戳转Date date=DateUtil.date(System.currentTimeMillis()); ...https://blog.csdn.net/liliyoung_/article/details/143979437
3.SpringBoot3.x中使用SpringDoc2/Swagger3(详解)这里我采用了 Swagger3.0(Open API 3.0)的方式集成到 SpringBoot。springfox-boot-start 和 springfox-swagger2 都是基于 Swagger2.x 的。 这里将介绍 springdoc-openapi-ui,它是 SpringBoot 基于 Open API 3.0(Swagger3.0) SpringFox 与 Swagger 的关系 ...https://cloud.tencent.com/developer/article/2470093
4.Linux系统之iotop命令的基本使用腾讯云开发者社区iotop 是一个类似于 top 的命令行工具,但它专注于显示实时的磁盘I/O使用情况。这个工具可以帮助你找出哪些进程正在大量地读写磁盘,对于诊断系统性能问题非常有用,特别是在磁盘I/O成为瓶颈时。 二、iotop命令的使用帮助 2.1 安装iotop 如果系统上没有安装iotop工具,则执行以下命令进行安装。 https://cloud.tencent.com.cn/developer/article/2466191
5.如何在项目中利用spring的扩展点来简化针对每次HTTP请求,Spring容器会根据loginAction bean的定义创建一个全新的LoginAction bean实例,且该loginAction bean实例仅在当前HTTP request内有效,因此可以根据需要放心的更改所建实例的内部状态,而其他请求中根据loginAction bean定义创建的实例,将不会看到这些特定于某个请求的状态变化。当处理请求结束,request作用域的...https://blog.51cto.com/u_12868/12582279
6.x[展开层数]的详细用法和举例?简介:-x [展开层数] 的详细用法和举例? Arthas的-x [展开层数]选项用于指定在跟踪方法调用时展开的调用栈层级数。以下是关于该选项的详细用法和举例: 详细用法 基本概念:-x [展开层数]选项用于控制方法调用栈的展开层级,即在打印方法调用信息时,显示多少层的调用关系。默认情况下,如果不加这个参数,那么只会显示...http://aliyun.liiix.com/?article/1640696
7.(ShellExecuteShellExecuteExecuteExSHELLEXECUTEINFO)启动...应用程序找到文件对象后,下一步通常是以某种方式对其进行操作。 例如,应用程序可能想要启动另一个允许用户修改数据文件的应用程序。 如果感兴趣的文件是可执行文件,则应用程序可能只需启动它。 本文档讨论如何使用ShellExecute或ShellExecuteEx 执行这些任务。 https://msdn.microsoft.com/zh-cn/library/windows/desktop/bb776886
8.GitHub基本用法: # 默认显示找到的种子列表 ptool batchdl <site> # 下载找到的种子到当前目录 ptool batchdl <site> --download # 直接将种子添加到 "local" BT 客户端里 ptool batchdl <site> --add-client local 此命令提供非常多的配置参数。部分参数: ...https://github.com/sagan/ptool