MAXRSIZE Maximum recoverable size from a Wavelet transform MAXRSIZE (LW,K) returns the size of the largest vector that can be reconstructed from the K-scales wavelet transform of length LW. This maximum size can be the same as LW or LW+1 (because of the transformation method) If there's no vector whose K-scales Wavelet transform is LW samples long, the return value is 0. See also: WVLTSIZE, WT, WT2D, BANDSITE. $Id: maxrsize.m,v 1.1 2004/09/26 04:00:24 matthewbrett Exp $
0001 function s=maxrsize(lw,k) 0002 0003 % MAXRSIZE Maximum recoverable size from a Wavelet transform 0004 % 0005 % MAXRSIZE (LW,K) returns the size of the largest 0006 % vector that can be reconstructed from the K-scales 0007 % wavelet transform of length LW. This maximum size 0008 % can be the same as LW or LW+1 (because of the 0009 % transformation method) 0010 % 0011 % If there's no vector whose K-scales Wavelet transform 0012 % is LW samples long, the return value is 0. 0013 % 0014 % See also: WVLTSIZE, WT, WT2D, BANDSITE. 0015 % 0016 % 0017 % $Id: maxrsize.m,v 1.1 2004/09/26 04:00:24 matthewbrett Exp $ 0018 0019 %-------------------------------------------------------- 0020 % Copyright (C) 1994, 1995, 1996, by Universidad de Vigo 0021 % 0022 % 0023 % Uvi_Wave is free software; you can redistribute it and/or modify it 0024 % under the terms of the GNU General Public License as published by the 0025 % Free Software Foundation; either version 2, or (at your option) any 0026 % later version. 0027 % 0028 % Uvi_Wave is distributed in the hope that it will be useful, but WITHOUT 0029 % ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0030 % FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0031 % for more details. 0032 % 0033 % You should have received a copy of the GNU General Public License 0034 % along with Uvi_Wave; see the file COPYING. If not, write to the Free 0035 % Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 0036 % 0037 % Author: Sergio J. Garcia Galan 0038 % e-mail: Uvi_Wave@tsc.uvigo.es 0039 %-------------------------------------------------------- 0040 0041 0042 s=0; 0043 l=0; 0044 x=floor(lw/2); 0045 0046 while (s==0) & (l<=k), 0047 testsize = x-l; 0048 lo(1)=2*testsize; 0049 0050 for i=1:k 0051 lo(i+1)=floor((lo(i)+1)/2); 0052 end 0053 check=sum(lo(2:k+1))+lo(k+1); 0054 if check==lw, 0055 s=testsize*2; 0056 end 0057 l=l+1; 0058 end