iirpar.m

来自「Matlab时频分析工具箱,希望能对大家有所帮助啊」· M 代码 · 共 89 行

M
89
字号
function [L,tfr]=iirpar(varargin)%IIRPAR  Parameters for IIR windows%   Usage:  [L,tfr]=iirpar(Ls,a,M);%           [L,tfr]=iirpar('dgt',Ls,a,M);%           [L,tfr]=iirpar('dwilt',Ls,M);%           [L,tfr]=iirpar('mdct',Ls,M);%%   [L,tfr]=IIRPAR(Ls,a,M) or [L,tfr]=iirpar('dgt',Ls,a,M) calculates the %   mimumal transform length L for a DGT of a signal of length Ls with%   parameters a and M. L is always larger than Ls. The parameters tfr%   describes the time-to-frequency ratio of the choosen lattice.%%   An example can most easily describe the use of IIRPAR. Assume that%   with wish to perform Gabor analysis of an input signal f with a %   suitable Gaussian window and lattice given by a and M. The following%   code will always work:% %      Ls=length(f);%      [L,tfr]=iirpar(Ls,a,M);%      g=pgauss(L,tfr);%      c=dgt(f,g,a,M);% %   [L,tfr]=IIRPAR('dwilt',Ls,M) and [L,tfr]=IIRPAR('mdct',Ls,M) will%   do the same for a Wilson/MDCT basis with M channels.%%   SEE ALSO:  DGT, DWILT, PGAUSS, PSECH, PHERM% This program is free software: you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation, either version 3 of the License, or% (at your option) any later version.% % This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% GNU General Public License for more details.% % You should have received a copy of the GNU General Public License% along with this program.  If not, see <http://www.gnu.org/licenses/>.error(nargchk(3,4,nargin));if ischar(varargin{1})    ttype=varargin{1};    pstart=2;else    ttype='dgt';    pstart=1;end;Ls=varargin{pstart};if (numel(Ls)~=1 || ~isnumeric(Ls))  error('Ls must be a scalar.');end;if rem(Ls,1)~=0  error('Ls must be an integer.');end;switch(lower(ttype))    case 'dgt'        if nargin<pstart+2            error('Too few input parameters for DGT type.');        end;                a=varargin{pstart+1};        M=varargin{pstart+2};                smallest_transform=lcm(a,M);        L=ceil(Ls/smallest_transform)*smallest_transform;        b=L/M;        tfr=a/b;    case {'dwilt','mdct'}        if nargin<pstart+1            error('Too few input parameters for DWILT/MDCT type.');        end;        M=varargin{pstart+1};        smallest_transform=2*M;        L=ceil(Ls/smallest_transform)*smallest_transform;        b=L/(2*M);        tfr=M/b;    otherwise        error('Unknown transform type.');end;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?