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

📄 comp_s.m

📁 linear time-frequency toolbox
💻 M
字号:
function f=comp_s(self,c,dorect,callfun,Ls)%COMP_S  Synthesis transform, rectangular layout%  Usage: f=comp_s(tfr,c,dorect,callfun)%         f=comp_s(tfr,c,dorect,callfun,Ls)%%   Input parameters:%         tfr   : Time/frequency representation handle.%         c     : Array of coefficients.%         Ls    : length of signal.%   Output parameters:%         f     : Signal.%%   COMP_S(tfr,c) computes the synthesis transform of the coefficients c as%   speficied by tfr.%%   COMP_S(tfr,c,Ls) does as above but cuts or extends f to length Ls.%%   SEE ALSO:  TFR_CREATE, TFR_AR, TFR_CLEARglobal TF_STORAGE;% Verify that TF_STORAGE has been initializedif prod(size(TF_STORAGE))==0  error([callfun, 'Please run tfr_init to obtain a valid handle.']);end;% Easy referencesa=TF_STORAGE.data{self}.a;M=TF_STORAGE.data{self}.M;R=TF_STORAGE.data{self}.R;dgtinfo=TF_STORAGE.data{self}.dgtinfo;% Determine parameters from shape of input coefficients.if dorect  switch dgtinfo.tt    case {'dwilt','dwiltii'}      N=size(c,2)*2;    otherwise      N=size(c,2);  end;    L=N*a;    winpos=assert_winready(self,L,2,1,0,callfun);  wininfo=TF_STORAGE.data{self}.w{winpos};  % We are doing multiwindow.  % third dimension is no. of window.  % fourth dimension is no. of signal.  if R>1    W=size(c,4);    if size(c,3) ~= dgtinfo.R      error('TFR_SR: size of input array does not fit no. of windows in multiwindow.');    end;    % Number of signal times number of windows. These are treated together.    WR=W*R;    else    W=size(c,3);    WR=W;  end;  c=reshape(c,M*N*wininfo.R,W);else    MNR=size(c,1);  W=size(c,2);  N=MNR/R/M;  WR=W*R;  if rem(N,1)~=0    error([callfun, 'Shape of array does not fit the transform.'])  end;  L=a*N;  winpos=assert_winready(self,L,2,1,0,callfun);    wininfo=TF_STORAGE.data{self}.w{winpos};end;L_dgt=L*dgtinfo.Lmul;a_dgt=dgtinfo.a;M_dgt=dgtinfo.M;N_dgt=L_dgt/a_dgt;% pre-process if not doing a dgt.if ~strcmp(dgtinfo.tt(1:3),'dgt')  c=feval(['comp_i',dgtinfo.tt],c,a,M);else  c=reshape(c,M,N*R*W);end;% Pre-process if c_t is different from 0.if (dgtinfo.c_t~=0)  halfmod=repmat(exp(2*pi*i*dgtinfo.c_t*((0:M_dgt-1)+dgtinfo.c_f).'/M_dgt),1,N_dgt*WR);  % The following is necessary because REPMAT does not work for  % 3D arrays.  halfmod=reshape(halfmod,M_dgt,N_dgt,WR);      c=c.*halfmod;end;% Eventual phaselockingif TF_STORAGE.data{self}.phaselock  c=reshape(c,M_dgt,N_dgt*WR);  c=iphaselock(c,a_dgt);  c=reshape(c,M_dgt,N_dgt,WR);end;% Do the DGT part.if abs(wininfo.Lwin)==L  % Do full-window algorithm.  % Apply ifft to the coefficients.  c=ifft(c)*sqrt(M_dgt);    % Get the factorization of the window.  % Call the computational subroutine.  % Recover from the factorization  gf = TF_STORAGE.data{self}.w{winpos}.gf;  f = comp_idgt_fw(c,gf,L_dgt,a_dgt,M_dgt);  else  % Do filter bank algorithm.  % Call the computational subroutine.  f=comp_idgt_fb(reshape(c,M*N,WR),g,a,M);  end;% Postprocess to handle c_f different from 0.if (dgtinfo.c_f~=0)  halfmod=exp(2*pi*i*dgtinfo.c_f*(0:L_dgt-1).'/M_dgt);  f=f.*repmat(halfmod,1,WR);end;if dgtinfo.Lmul==2  f=f(1:L,:);end;% Cut or extend f to the correct length, if desired.if Ls>-1  f=postpad(f,Ls);else  Ls=L;end;wasrow=0;f=comp_sigreshape_post(f,Ls,wasrow,[0; W]);

⌨️ 快捷键说明

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