前言

之前讲了MTM(多锥形窗谱估计)的相关原理,现在来分析一下它的matlab实现。
想要复习的可以参考一下之前的文件:
现代谱估计:多窗口谱
想要复习一下如何实现的可以参考:
MTM:matlab实现1MTM:matlab实现1

目录

  • 前言
  • 目录
  • 正文
    • parseinputs
  • computeDFT

正文

接着上回的讲剩下的那两个子函数:

parseinputs

解析输入的列表参数
解析输入传递到pmtm.m的参数并返回一个结构包括所有的参数传递给pmtm集合,可能是默认值也可能是用户定义的值。
%----------------------------------------------------------------------
function params = parseinputs(x,varargin)
%PARSEINPUTS Parse the inputs passed to pmtm.m and return a structure
%            containing all the parameters passed to PMTM set to either
%            default values or user defined values.
%
输入
x 输入的数据向量
vararginpmtm传给的输入参数列表,除了数据x
% Inputs:
%   x        - Input data vector.
%   varargin - Input parameter list passed to pmtm, except for x.
%输出
params 是个结构体,包含了pmtm的输入参数列表,除了输入数据x,它
包含以下值域。
% Outputs:
%   params   - Structure containing pmtm's input parameter list, except for
%              the input data sequence, x; it contains the following fields:
nfft 评估psd的频率点数,默认是接近输入的2的n次方%      nfft     - Number of frequency points to evaluate the PSD at; %                 the default is max(256,2^nextpow2(N)).Fs 采样频率
%      Fs       - The sampling frequency; default is .
range 默认是单边,复信号是双边。%      range    - default is 'onesided' or real signals and 'twosided' for
%               - complex signals.
conflevel 置信度水平%      conflevel- Confidence level (preferred syntax)置信度水平,默认是0,95
%      ConfInt  - Confidence interval; default is .95. (legacy syntax)谱估计时使用的方法,默认的是adaptive。
%      MTMethod - Algorithm used in MTM; default is 'adapt'.
E 包含有离散扁球序列的矩阵
%      E        - Matrix containing the discrete prolate spheroidal
%                 sequences.
v 向量包含 dpss的中心%      V        - Vector containing the concentration of the dpss.NW 时间带宽积
%      NW       - Time-bandwidth product; default is 4.
%
err——msd 反馈错误信息。
%   err_msg  - String containing an error message if an error occurred.
错误信息提示
if any(strcmp(varargin, 'whole'))warning(message('signal:pmtm:invalidRange', 'whole', 'twosided'));
elseif any(strcmp(varargin, 'half'))warning(message('signal:pmtm:invalidRange', 'half', 'onesided'));
end
初始化默认的参数值
% Set default parameter values.
N = size(x,1);
params  = [];解析输入参数到NFFT,如果包含
如果没有指定e和v,则计算它们
% Parse the input arguments up to NFFT (exclusive).
% If E and V are not specified, calculate them.
[E,V,NW,indx,nfft_temp,varargin] = getEV(N,varargin{:});强制执行精确规则
% Cast to enforce Precision Rules
if (any([signal.internal.sigcheckfloattype(x,'single','pmtm','X') ...signal.internal.sigcheckfloattype(E,'single','pmtm','E') ...signal.internal.sigcheckfloattype(V,'single','pmtm','V')]))x = single(x);E = single(E);V = single(V);
end
NW 数值转化
NW = double(NW);
如果x是实数,且nfft的长度《=1
if isreal(x) && (length(nfft_temp) <= 1), range = 'onesided';
elserange = 'twosided';
end注意:功率谱估计函数要求一个包含以下值域的结构体,任何对这个结构的改变,都必须在调用后做完。
% NOTE: The psdoptions function REQUIRES a structure with the following
%       fields.  Any changes to the structure, such as adding/removing
%       fields, should be done after the call to psdoptions.params.nfft    = max(256,2^nextpow2(N));
params.Fs      = [];
params.range   = range;
params.centerdc = false;
params.conflevel = 'omitted';
遗漏设置
params.ConfInt = 'omitted';
params.MTMethod= 'adapt';
调用功率谱选项来解决遗留的以NFFT开始的输入参数列表
% Call psdoptions to handle the remaining input arg list starting with NFFT.
重写默认选项,使用用户特定的值。
% Overwrite default options with user specified options (if specified).
如果indx小于 参数的数量
if indx <= numel(varargin)检测相关输入参数是否合法。% Invalid character inputs for NW, NFFT, W, E,V and Fs is checked here[params,err_msg,err_msgobj] = psdoptions(isreal(x),params,varargin{indx:end});if err_msg, error(err_msgobj), end;     if ~strcmp(params.conflevel,'omitted') && ~strcmp(params.ConfInt, 'omitted')% user specified too many scalar inputs in conjunction with 'ConfidenceLevel'error(message('signal:pmtm:TooManyScalarNumericInputs'));endif length(params.nfft) > 1,if strcmpi(params.range,'onesided')warning(message('signal:pmtm:InconsistentRangeOption'));endparams.range = 'twosided'`#
##end得到子函数的生成的dpss
% Add remaining fields to the return structure.
params.E  = E;
params.V  = V;
params.NW = NW;

computeDFT

computeDFT Computes DFT using FFT or GoertzelThis function is used to calculate the DFT of a signal using the FFT or the Goertzel algorithm. [XX,F] = computeDFT(XIN,NFFT) where NFFT is a scalar and computes the DFT XX using FFT. F is the frequency points at which the XX is computed and is of length NFFT.[XX,F] = computeDFT(XIN,F) where F is a vector with at least two elements computes the DFT XX using the Goertzel algorithm. [XX,F] = computeDFT(...,Fs) returns the frequency vector F (in hz)where Fs is the sampling frequencyInputs:XIN is the input signalNFFT if a scalar corresponds to the number of FFT points used to calculate the DFT using FFT.NFFT if a vector corresponds to the frequency points at which the DFTis calculated using goertzel.FS is the s mp ing frequency

MTM:matlab实现2参数解析相关推荐

  1. Matlab中的参数解析

    本文中,我们讨论如何在Matlab中进行参数解析. 参数解析对于软件开发和程序设计至关重要.在Matlab中,函数参数传递一般采用直接传值方式,最复杂的情况下也就是使用varargin变长数组.那么如 ...

  2. MATLAB plot绘图参数解析

    功能 二维曲线绘图 语法 1 2 3 4 5 6 7 plot(Y) plot(X1,Y1,...) plot(X1,Y1,LineSpec,...) plot(...,'PropertyName', ...

  3. Matlab函数trainingOptions参数解析

    版本matlab 2018b function opts = trainingOptions(solverName, varargin) solverName: 'sgdm' - 带动量的随机梯度下降 ...

  4. matlab 变压器 漏感,中频变压器漏感参数解析计算方法.doc

    摘要:当今社会,伴随着电力电子器件和高频磁性材料的发展,电力电子变压器被越来越多地引入到高压大功率的应用领域.由于大功率中频变压器具有较高的工作频率,且变压器原一.二次绕组都与电力电子换流器进行连接, ...

  5. Go 学习笔记(45)— Go 标准库之 flag(命令行参数解析)

    1. 参数解析说明 import "flag" flag 包实现了命令行参数的解析.每个参数认为一条记录,根据实际进行定义,到一个 set 集合.每条都有各自的状态参数. 使用 f ...

  6. google gflags的参数解析,便捷实用

    命令行参数解析,一直是我们后段开发人员需要经常使用的一个功能,用来从终端解析接口的输入 ,并做出对应的处理.这里为使用C++/python的开发人员推荐一个便捷的命令行解析接口集 gflags. 我们 ...

  7. 【Qt】通过QtCreator源码学习Qt(六):命令行参数解析实现

    参考下大神的命令行参数解析是如何是实现的 //使用const char []代替宏定义字符串,我以前都是用const QString,想想好傻 const char SETTINGS_OPTION[] ...

  8. url参数解析 url解析 ?解析成对象

    微信小程序开发交流qq群   173683895    承接微信小程序开发.扫码加微信. 正文: 代码: // url参数解析 function getUrlkey(url) {var params ...

  9. JS 把url的参数解析成对象

    微信小程序开发交流qq群   173683895    承接微信小程序开发.扫码加微信. 正文: 实现思路:请看log和打印结果 // url参数解析 function getUrlkey(url) ...

最新文章

  1. 声明了变量并赋了初始值,但在VS中报当前上下文中不存在名称“ XXX”的错误...
  2. 记录下openstack部署和使用时遇到的一些问题
  3. linux一键重装系统脚本,一键重装CentOS纯净版系统shell脚本
  4. 3.6 激活函数-深度学习-Stanford吴恩达教授
  5. Python参数类型
  6. 切面是异步还是同步操作‘_细说JS异步发展历程
  7. 查看当前内存使用情况---练习记录
  8. 中文深度学习入门书:小白易入,课程、实战项目全有 | 五位导师联合出品
  9. Linux学习之二十、循环
  10. 推理集 —— death
  11. c 语言自动关机代码,自动关机 C语言源代码
  12. 软件工程(吕云翔第二版)部分简答题答案
  13. 科赫雪花java_java递归实现科赫雪花
  14. 车牌字符识别算法原理
  15. js习题(模拟京东快递单号查询)
  16. 计算机毕业设计ssm文档资料管理系统
  17. 静态函数和非静态函数的区别(静态方法和非静态方法)
  18. 启明云端分享|IDO-SOM3568:可用于轻量级人工智能应用
  19. Simulink永磁同步电机控制仿真系列五:使用滑模观测器的反电动势法位置估计
  20. ASP.Net MVC3 图片上传详解(form.js,bootstrap)

热门文章

  1. avenue在科研文章中的意思
  2. turnitin时间
  3. 《拆弹专家2》观后感
  4. 当你所有的尝试告一段落
  5. MVC4 WebAPI(一)
  6. Javascript String类的属性及方法
  7. 关于JAVA中子类和父类的构造方法
  8. Java中的Atomic包
  9. 【转】商业内幕(Business Insider)网站近期评出了全美20家最具创新力的科技创业公司...
  10. mysql主从日志的定期清理