www.pudn.com > TimeFrequency.rar > cwtnew.m


function coefs = cwtnew(signal,scales,wname,plotmode,xlim) 
%CWT Real or Complex Continuous 1-D wavelet coefficients. 
%   COEFS = CWT(S,SCALES,'wname') computes the continuous 
%   wavelet coefficients of the vector S at real, positive 
%   SCALES, using wavelet whose name is 'wname'. 
%   The signal S is real, the wavelet can be real or complex.  
% 
%   COEFS = CWT(S,SCALES,'wname','plot') computes 
%   and, in addition, plots the continuous wavelet 
%   transform coefficients. 
% 
%   COEFS = CWT(S,SCALES,'wname',PLOTMODE) computes and, 
%   plots the continuous wavelet transform coefficients. 
%   Coefficients are colored using PLOTMODE. 
%   PLOTMODE = 'lvl' (By scale) or  
%   PLOTMODE = 'glb' (All scales) or 
%   PLOTMODE = 'abslvl' or 'lvlabs' (Absolute value and By scale) or 
%   PLOTMODE = 'absglb' or 'glbabs' (Absolute value and All scales) 
% 
%   CWT(...,'plot') is equivalent to CWT(...,'absglb') 
% 
%   You get 3-D plots (surfaces) using the same keywords listed 
%   above for the PLOTMODE parameter, preceded by '3D'. For example: 
%   COEFS = CWT(...,'3Dplot') or COEFS = CWT(...,'3Dlvl'). 
% 
%   COEFS = CWT(S,SCALES,'wname',PLOTMODE,XLIM) computes, and 
%   plots, the continuous wavelet transform coefficients. 
%   Coefficients are colored using PLOTMODE and XLIM. 
%   XLIM = [x1 x2] with 1 <= x1 < x2 <= length(S). 
% 
%   For each given scale a within the vector SCALES, the   
%   wavelet coefficients C(a,b) are computed for b = 1 to 
%   ls = length(S), and are stored in COEFS(i,:) 
%   if a = SCALES(i).  
%   Output argument COEFS is a la-by-ls matrix where la  
%   is the length of SCALES. COEFS is a real or complex matrix 
%   depending on the wavelet type. 
% 
%   Examples of valid uses are: 
%   t = linspace(-1,1,512); 
%   s = 1-abs(t); 
%   c = cwt(s,1:32,'cgau4'); 
%   c = cwt(s,[64 32 16:-2:2],'morl'); 
%   c = cwt(s,[3 18 12.9 7 1.5],'db2'); 
%   c = cwt(s,1:32,'sym2','lvl'); 
%   c = cwt(s,1:64,'sym4','abslvl',[100 400]); 
% 
%   See also WAVEDEC, WAVEFUN, WAVEINFO, WCODEMAT. 
 
%   M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 12-Mar-96. 
%   Last Revision: 02-Feb-2000. 
%   Copyright 1995-2002 The MathWorks, Inc. 
%   $Revision: 1.18 $ $Date: 2002/03/28 17:24:50 $ 
 
% Check arguments. 
if errargn(mfilename,nargin,[3:5],nargout,[0 1]), error('*'), end 
err = 0; 
if isempty(scales) ,         err = 1; 
elseif min(size(scales))>1 , err = 1; 
elseif min(scales)len , xlim(2) = len; end 
    indices = [xlim(1):xlim(2)]; 
    switch plotmode 
      case {'glb','absglb'} 
        cmin = min(min(dummyCoefs(:,indices))); 
        cmax = max(max(dummyCoefs(:,indices))); 
        dummyCoefs(dummyCoefscmax) = cmax; 
 
      case {'lvl','abslvl'} 
        cmin = min((dummyCoefs(:,indices))')'; 
        cmax = max((dummyCoefs(:,indices))')'; 
        for k=1:nbscales 
            ind = dummyCoefs(k,:)cmax(k); 
            dummyCoefs(k,ind) = cmax(k); 
        end 
    end 
end 
 
nb    = min(5,nbscales); 
level = ''; 
for k=1:nb , level = [level ' '  num2str(scales(k))]; end 
if nb