📄 tfr_create.m
字号:
function self=tfr_create(tt,a,M,awin,swin,varargin);%TFR_CREATE Create time-frequency representation object% Usage: tfr=tfr_create(tt,a,M,awin,swin);%% Input parameters:% tt : Name of transform.% a : Time shift.% M : Number of channels.% awin : Analysis window.% swin : Synthesis window.% options : Cell array of options (optional)% Output:% tfr : Handle to this TF representation.%% This function creates a time-frequency representation% represented by the variable tfr.%% tt can be one of: 'dgt', 'rdgt', 'rdgt2', 'dwilt',% 'edgt6'%% awin and swin can be one of 'none','pgauss','candual','cantight'% 'pherm'%% options can be one of 'phaselock'%% %% SEE ALSO: TFR_AR, TFR_SR, TFR_CLEAR%error(nargchk(3,6,nargin)); if nargin<3 error('Too few input arguments.');end;if nargin<=5 options={};end;if nargin<=4 swin='none';end;if nargin<=3 awin='none';end; global TF_STORAGE;% Initialise it for the first time.if prod(size(TF_STORAGE))==0 TF_STORAGE.next=1; TF_STORAGE.data={};end;% Get the number of the next available slot.self=TF_STORAGE.next;% Increse the counter so it is ready for next invocation.TF_STORAGE.next=TF_STORAGE.next+1;% Check tt, a and M for validity and get information% about which DGT the transform relates to. dgtinfo=assert_tt(tt,a,M,'TFR_CREATE');% Check awin and swin[awininfo,ait]=assert_win(awin,dgtinfo,'awin','TFR_CREATE');[swininfo,sit]=assert_win(swin,dgtinfo,'swin','TFR_CREATE');% Both windows cannot depend on each otherif awininfo.otherdepend && swininfo.otherdepend error(['TFR_CREATE: Both windows cannot depend on each other.']);end;% Both windows cannot be specified as tight.if ait && sit error(['TFR_CREATE: Both windows cannot be tight.']);end;% Determine is we are using a tight window. Meaning of istight is:% 0 - no window is tight.% 1 - analysis window is specified as tight.% 2 - synthesis window is specified as tight.istight=0;if ait==1 istight=1;end;if sit==1 istight=2;end;% ------- parse additional options -----------phaselock=0;for ii=1:length(varargin) option=varargin{ii}; switch(lower(option)) case {'phaselock'} phaselock=1; end;end;% Determine R. Either both window have the same width, or one% window has width zero, meaning that it is flexible.if ~((awininfo.R*swininfo.R==0) || (awininfo.R==swininfo.R)) error('Incorrect window combination: Windows must have the same width.')end;if awininfo.R==swininfo.R R=awininfo.R;else R=awininfo.R+swininfo.R;end;% Load up the information.TF_STORAGE.data{self}.tt=tt;TF_STORAGE.data{self}.a=a;TF_STORAGE.data{self}.M=M;TF_STORAGE.data{self}.dgtinfo=dgtinfo;TF_STORAGE.data{self}.w{1}=awininfo;TF_STORAGE.data{self}.w{2}=swininfo;TF_STORAGE.data{self}.istight=istight;TF_STORAGE.data{self}.phaselock=phaselock;TF_STORAGE.data{self}.R=R;% These parameters indicate a rectangular latticeTF_STORAGE.data{self}.s1=0;TF_STORAGE.data{self}.s2=1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -