⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tfr_a.m

📁 linear time-frequency toolbox
💻 M
字号:
function [c,Ls]=tfr_a(self,f,L,dim)%TFR_A  Analysis transform%   Usage:  c=tfr_a(tfr,f)%           c=tfr_a(tfr,f,L)%           [c,Ls]=tfr_a(tfr,f);%           [c,Ls]=tfr_a(tfr,f,L);%           [c,Ls]=tfr_a(tfr,f,[],dim);%           [c,Ls]=tfr_a(tfr,f,L,dim);%%   Input parameters:%         tfr   : Time/frequency representation handle.%         f     : Input data%         L     : Length of transform to do.%         dim   : Dimension of which to do the transform.%   Output parameters:%         c     : Array of coefficients.%         Ls    : Length of input signal.%%   TFR_A(tfr,f) computes the analysis transform of the signal f as%   specified by tfr.%%   The length of the transform will be the smallest possible that is%   larger than the signal. f will be zero-extended to the length of the %   transform. If f is a matrix, the transformation is applied to each column.%%   The length of the transform done can be obtained by L=size(c,2)*a;   %%   TFR_A(tfr,f,L) computes the analysis transform as above, but does%   a transform of length L. f will be cut or zero-extended to length L%   before the transform is done.%%   [c,Ls]=TFR_A(tfr,f) or [c,Ls]=TFR_A(tfr,f,L) additionally returns the%   length of the input signal f. This is handy for reconstruction:% %                [c,Ls]=tfr_a(tfr,f)%                fr=tfr_s(c,Ls);% %   will reconstruct the signal f no matter what the length of f is, provided%   that the analysis and synthesis window of tfr are dual windows.%%   TFR_A(tfr,f,[],dim) applies the transformation along dimension dim.%   TFR_A(tfr,f,L,dim) does the same, but pads or truncates to length L.%%   SEE ALSO:  TFR_CREATE, TFR_S, TFR_AR, TFR_CLEARerror(nargchk(2,4,nargin));D=ndims(f);if nargin<4  dim=1;else  if (prod(size(dim))~=1 || ~isnumeric(dim))    error('dim must be a scalar.');  end;  if rem(dim,1)~=0    error('dim must be an integer.');  end;  if (dim<1) || (dim>D)    error(sprintf('dim must be in the range from 1 to %d.',D));  end;end;if nargin<3  L=-1;else  if isempty(L)    L=-1;  end;    end;if dim>1  D=ndims(f);  order=[dim, 1:dim-1,dim+1:D];  % Put the desired dimension first.  f=permute(f,order);end;% Remember the exact size for later.permutedsize=size(f);  % Reshape f to a matrix.f=reshape(f,size(f,1),prod(size(f))/size(f,1));% Let comp_a do all the work.[c,Ls]=comp_a(self,f,0,'TFR_A',L);% Remember that we changed the length of the first dim.permutedsize(1)=size(c,1);% Restore the original, permuted shape, except for the first dimension% which changed.c=reshape(c,permutedsize);if dim>1  % Undo the permutation.  c=ipermute(c,order);end;

⌨️ 快捷键说明

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