From 958f2a83fef0d9131bc43b680d058289208c1d1f Mon Sep 17 00:00:00 2001 From: Zdenek Prusa Date: Fri, 2 Dec 2016 11:37:24 +0100 Subject: [PATCH] Doc updates and few new checks --- filterbank/filterbankscale.m | 2 ++ frames/frsyniter.m | 16 ++++++++++++++++ frames/frsynmatrix.m | 2 +- sigproc/firwin.m | 15 ++++++++++----- sigproc/freqwin.m | 7 +------ testing/test_firwin.m | 5 +---- 6 files changed, 31 insertions(+), 16 deletions(-) diff --git a/filterbank/filterbankscale.m b/filterbank/filterbankscale.m index 12a1d321..1a548739 100644 --- a/filterbank/filterbankscale.m +++ b/filterbank/filterbankscale.m @@ -26,6 +26,8 @@ % the input filters. % +%AUTHOR: Zdenek Prusa + complainif_notenoughargs(nargin,2,'FILTERBANKSCALE'); definput.import={'normalize'}; diff --git a/frames/frsyniter.m b/frames/frsyniter.m index 8c265490..b9ea298f 100644 --- a/frames/frsyniter.m +++ b/frames/frsyniter.m @@ -43,6 +43,22 @@ % % 'quiet' Don't print anything, this is the default. % +% Algorithms +% ---------- +% +% The function uses the (Preconditioned) Conjugate Gradient algorithm +% to solve the following problem:: +% +% .. FF*f=Fc +% +% .. math:: FF* f = Fc +% +% The preconditioning alters the equations such that +% +% .. inv(M)FF*f=inv(M)Fc +% +% .. math:: M^{-1}FF* f = M^{-1}Fc +% % Examples % -------- % diff --git a/frames/frsynmatrix.m b/frames/frsynmatrix.m index 2e2327e7..155b665c 100644 --- a/frames/frsynmatrix.m +++ b/frames/frsynmatrix.m @@ -14,7 +14,7 @@ % *L*. % % The action of the frame analysis operator |frana| is equal to -% multiplication with the Hermitean transpose of the frame +% multiplication with the Hermitean transpose of the frame synthesis % matrix. Consider the following simple example::: % % L=200; diff --git a/sigproc/firwin.m b/sigproc/firwin.m index 8f194449..b76ed4bb 100644 --- a/sigproc/firwin.m +++ b/sigproc/firwin.m @@ -1,4 +1,4 @@ -function [g,info]=firwin(name,M,varargin); +function [g,info]=firwin(name,M,varargin) %FIRWIN FIR window % Usage: g=firwin(name,M); % g=firwin(name,M,...); @@ -165,12 +165,16 @@ if nargin<2 error('%s: Too few input parameters.',upper(mfilename)); -end; +end if ~ischar(name) - error('%s: First input argument must the name of a window.',upper(mfilename)); -end; - + error('%s: First input argument must the name of a window.',... + upper(mfilename)); +end + +if ~isnumeric(M) + error('%s: M must be numeric.',upper(mfilename)); +end % Always set to this info.isfir=1; @@ -205,6 +209,7 @@ end; if numel(M)==1 + complainif_notposint(M,'M',mfilename); % Deal with tapering if kv.taper<1 diff --git a/sigproc/freqwin.m b/sigproc/freqwin.m index 85a4d384..7aa6d78e 100644 --- a/sigproc/freqwin.m +++ b/sigproc/freqwin.m @@ -102,17 +102,12 @@ switch winName case 'gauss' H = exp(4*H.^2*log(bwrelheight)/(bw/step)^2); - + case 'butterworth' definputbutter.keyvals.order=4; [~,~,order]=ltfatarghelper({'order'},definputbutter,winArgs); H = 1./(sqrt(1 + (H/(bw/step/2)).^(2*order))); - case 'chebyschevI' - definputchebyI.keyvals.ripplefac = 0.01; - [~,~,ripplefac]=ltfatarghelper({'ripplefac'},definputchebyI,winArgs); - - case 'gammatone' definputgamma.keyvals.order=4; [~,~,order]=ltfatarghelper({'order'},definputgamma,winArgs); diff --git a/testing/test_firwin.m b/testing/test_firwin.m index 1e8452db..ac4674d9 100644 --- a/testing/test_firwin.m +++ b/testing/test_firwin.m @@ -4,10 +4,7 @@ % This test script verifies the properties listed in the help of firwin -allwins = {'hann','tria','sine', ... - 'sqrttria','itersine', 'square','hamming','blackman', ... - 'nuttall','nuttall10', 'nuttall01','nuttall20','nuttall11', ... - 'nuttall02','nuttall30','nuttall21','nuttall03','blackman2'}; +allwins = getfield(arg_firwin,'flags','wintype'); test_failed=0;