📄 assert_win.m
字号:
function [info,istight]=assert_win(win,dgtinfo,winname,callfun)%ASSERT_WIN Assert that window function is valid% Usage: info=assert_win(win,dgtinfo,winname,callfun)%% Input parameters:% win : Representation of window, user input.% dgtinfo : Info structure from assert_tt% winname : name of win, e.g. 'awin' or 'swin'% callfun : name of calling function.% Output parameters:% info : Structure describing the window.% otherdepend : Proper calculation of window depend on the other.% istight : Window is tight% A window can be represented as a string, as a matrix or% as a cell array.% Does the full calculation of the window depend on the other window?info.otherdepend=0;% Is the window tight (i.e. replaces both windows)?istight=0;% Is the window a FIR window?info.isfir=0;% Does the window have a fixed size?info.isfixed=0;% Has a factorization been computed?info.hasfac=0;% Length of window:% 0 - not decided yet.% positive - FIR window of this length% negative - Full window of this lengthinfo.Lwin=0;% Size of multiwindowinfo.R=0;% Window is represented as a string.if ischar(win) win=lower(win); info.funpars={}; switch win case {'gauss','pgauss'} info.funname='pgauss'; info.funpars={[],[]}; info.R=1; case {'sech','psech'} info.funname='psech'; info.funpars={[],[]}; info.R=1; case 'none' case 'phanning' info.isfir=1; info.R=1; case 'candual' info.otherdepend=1; case 'cantight' info.otherdepend=1; istight=1; otherwise error([callfun,': ',win,', unknown window name']) end; info.name=win; info.win=win; end;% Window is represented as a cell arrayif iscell(win) if isempty(win) || ~ischar(win{1}) error([callfun,': ',winname,', first element must be a character string.']); end; npars=length(win); switch lower(win{1}) case {'pgauss','psech'} switch npars case 1 win{2}=[]; win{3}=[]; case 2 win{3}=[]; if ((prod(size(win{2}))>1) || ~isnumeric(win{2})) error([callfun,': tfr must be a scalar or an empty matrix']); end; case 3 if (prod(size(win{2}))>1 || ~isnumeric(win{2})) error([callfun,': tfr must be a scalar or an empty matrix']); end; if (prod(size(win{3}))~=1 || ~isnumeric(win{3})) error([callfun,': centering must be a scalar']); end; % Assert that the specified centering fits with the transform. if ((win{3}==0 && dgtinfo.iseven==2) && ... (win{3}==.5 && dgtinfo.iseven==1)) error('Specified centering of Gaussian or Sech window is in conflict with the centering allowed by the transform.'); end; otherwise error('Too many input parameters for Gaussian or Sech window.'); end; info.R=1; case {'pherm'} if npars<2 error([callfun,': An order must be specified for Hermite window.']); end; if sum(1-(size(win{2})==1))>1 error('"order" must be a scalar or vector'); end; info.R=length(win{2}); case {'pbspline','phanning'} info.isfir=1; info.R=1; otherwise error([callfun,': ',winname,', unknown window type.']); end; info.name=win{1}; info.win=win; info.funpars=win(2:end);end;if isnumeric(win) % We cannot know that the intention of the window is, so % we assume that it is a FIR window. info.isfir=1; Lwin=size(win,1); if ((dgtinfo.isreal) && (~isreal(win))) error([callfun,': ',winname,', window must be real valued.']); end; if ((dgtinfo.iseven==1) && (~iscentered(win))) error([callfun,': ',winname,', window must be whole point even.']); end; if dgtinfo.iseven==2 error('ASSERT_WIN half-point even check not handled yet.'); end; if mod(Lwin,dgtinfo.M)~=0 error([callfun,': ',winname,', the length of the window must be divisable by M.']); end; if mod(Lwin,dgtinfo.a)~=0 error([callfun,': ',winname,', the length of the window must be divisable by a.']); end; info.isfixed=1; info.name='numerical'; info.Lwin=Lwin; info.R=size(win,2); g_dgt=win; % Shift the window if requested. if (dgtinfo.c_w>0) g_dgt=circshift(win,dgtinfo.c_w); end; info.g_dgt=g_dgt; info.g=win;end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -