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

📄 dwilt.m

📁 Matlab时频分析工具箱,希望能对大家有所帮助啊
💻 M
字号:
function [c,Ls]=dwilt(f,g,M,L)%DWILT  Discrete Wilson transform.%   Usage:  c=dwilt(f,g,M);%           c=dwilt(f,g,M,L);%           [c,Ls]=dwilt(f,g,M);%           [c,Ls]=dwilt(f,g,M,L);%%   Input parameters:%         f     : Input data%         g     : Window function.%         M     : Number of bands.%         L     : Length of transform to do.%   Output parameters:%         c     : 2*M x N array of coefficients.%         Ls    : Length of input signal.%%   DWILT(f,g,M) computes a discrete Wilson transform%   with M bands and window g.%%   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 window g may be a text string decribing the window. The following%   types are recognized% %   'gauss'     - Gaussian window.%%   'dualgauss' - Canonical dual of Gaussian window.%%   'tight'     - Tight window generated from a Gaussian.%%   'sqrthann'  - Square root of Hanning window. This is a tight, FIR%                 window.  % %   DWILT(f,g,M,L) computes the Wilson 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]=DWILT(f,g,M) or [c,Ls]=DWILT(f,g,M,L) additionally return the%   length of the input signal f. This is handy for reconstruction:% %                [c,Ls]=dwilt(f,g,M);%                fr=idwilt(c,gd,M,Ls);% %   will reconstruct the signal f no matter what the length of f is, provided%   that gd is a dual Wilson window of g.%%   A Wilson transform is also known as a maximally decimated, even-stacked%   cosine modulated filter bank.%%   Assume that the following code has been executed for a column vector f:% %     c=dwilt(f,g,M);  % Compute a Wilson transform of f.%     N=size(c,2)*2;   % Number of translation coefficients.%%   The following holds for m=0,...,M-1 %   and n=0,...,N/2-1:%%   If m=0:% %                    L-1 %     c(m+1,n+1)   = sum f(l+1)*g(l-2*n*M+1)%                    l=0  % %   If m is odd and less than M% %                    L-1 %     c(m+1,n+1)   = sum f(l+1)*sqrt(2)*sin(pi*m/M*l)*g(k-2*n*M+1)%                    l=0  % %                    L-1 %     c(m+M+1,n+1) = sum f(l+1)*sqrt(2)*cos(pi*m/M*l)*g(k-(2*n+1)*M+1)%                    l=0  % %   If m is even and less than M% %                    L-1 %     c(m+1,n+1)   = sum f(l+1)*sqrt(2)*cos(pi*m/M*l)*g(l-2*n*M+1)%                    l=0  % %                    L-1 %     c(m+M+1,n+1) = sum f(l+1)*sqrt(2)*sin(pi*m/M*l)*g(l-(2*n+1)*M+1)%                    l=0  % %   if m=M and M is even:% %                    L-1 %     c(m+1,n+1)   = sum f(l+1)*(-1)^(l)*g(l-2*n*M+1)%                    l=0% %   else if m=M and M is odd% %                    L-1 %     c(m+1,n+1)   = sum f(l+1)*(-1)^l*g(l-(2*n+1)*M+1)%                    l=0%%   SEE ALSO:  IDWILT, DGT, MDCT, WILDUAL, WILORTH% %   REFERENCES:%     H. Bölcskei, H. G. Feichtinger, K. Gröchenig, and F. Hlawatsch.%     Discrete-time Wilson expansions. In Proc. IEEE-SP 1996 Int. Sympos.%     Time-Frequency Time-Scale Analysis, june 1996.%     %     Y.-P. Lin and P. Vaidyanathan. Linear phase cosine modulated maximally%     decimated filter banks with perfect reconstruction.%     IEEETrans.SignalProcess., 43(11):2525-2539, 1995.% 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/>.error(nargchk(3,4,nargin));if nargin<4  L=[];end;assert_squarelat(M,M,1,'DWILT',0);if isnumeric(g)  if size(g,2)>1    if size(g,1)>1      error('g must be a vector');    else      % g was a row vector.      g=g(:);    end;  end;  Lwindow=size(g,1);else  Lwindow=0;end;% Change f to correct shape.[f,Ls,W,wasrow,remembershape]=comp_sigreshape_pre(f,'DWILT',0);[b,N,L]=assert_L(Ls,Lwindow,L,M,2*M,'DWILT');g=comp_window(g,M,2*M,L,1,'DWILT');f=postpad(f,L);  % Call the computational subroutines.a=M;c2=comp_dgt(f,g,a,2*M,L,1);c=comp_dwilt(c2,a);% Get correct shape.c=reshape(c,M*2,N/2,W);% Clean coefficients if they are known to be real% If input is real, and window is real, output must be real as well.if (isreal(g) && isreal(f));  c=real(c);end;

⌨️ 快捷键说明

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