comp_window.m

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

M
77
字号
function [g,info] = comp_window(g,a,M,L,wilson,callfun);%COMP_WINDOW  Compute the window from text or cell array.%   Usage: [g,info] = comp_window(g,a,M,L,wilson,callfun);%%   [g,info]=COMP_WINDOW(g,a,M,L,wilson,callfun) will compute the window%   from a text description or a cell array containing additional%   parameters.%%   The structure info provides some information about the computed%   window:%%      info.gauss   - True if the window is a Gaussian.%%      info.tfr     - Time/frequency support ratio of the window. Set%                     whenever it makes sense.% % 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/>.  % Default values.info.gauss=0;    % Create window if string was given as input.if ischar(g)  switch(lower(g))   case {'pgauss','gauss'}    g=comp_pgauss(L,a*M/L,0);    info.gauss=1;    info.tfr=a*M/L;   case {'dualgauss','gaussdual'}    g=comp_pgauss(L,a*M/L,0);    g=candual(g,a,M);    if wilson      g=2*g;    end;    info.tfr=a*M/L;   case {'tight'}    g=cantight(a,M,L);    if wilson      g=g*sqrt(2);    end;    info.tfr=a*M/L;   case {'sqrthann','sqrthan'}    g=firwin('sqrthann',M);   otherwise    error('Unknown window type.');  end;end;if iscell(g)  if isempty(g) || ~ischar(g{1})    error('First element of window cell array must be a character string.');  end;    switch(lower(g{1}))   case {'pgauss','gauss'}    [g,info.tfr]=pgauss(L,g{2:end});    info.gauss=1;   case {'psech','sech'}    g=psech(L,g{2:end});   otherwise    error('Only Gaussian windows can be passed as cell arrays.');  end;end;

⌨️ 快捷键说明

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