imagerwt.sci

来自「小波分解源代码」· SCI 代码 · 共 69 行

SCI
69
字号
function ImageRWT(rwt,scaling,colors,option,oct,scale)
// ImageRWT -- Image of Continuous Wavelet Transform
//  Usage
//    ImageRWT(rwt,scaling,colors)
//  Inputs
//    rwt      matrix produced by RWT
//    scaling  string, 'Overall', 'Individual'
//    colors   string  argument for colormap
//    option   'lin' or 'log' for the type of display
//
//  Side Effects
//    Image Display of Continuous Wavelet Transform
//
//  Copyright Aldo I Maalouf

  [lhs,rhs]=argn();
	if rhs < 5,
		oct = 2;
		scale = 4;
	end
	if rhs < 4
       	    option = 'log';
	end
	sz     = size(rwt);
	n      = sz(1);
	nscale = sz(2);
	noctave= floor(log2(n)) -2;
	nvoice = nscale ./ noctave;


        if  string(option)=='log'     
	  ytix   = linspace(2+(oct-floor(log2(scale))),log2(n)+2-floor(log2(scale)),nscale);

	  xtix   = linspace(0,n,n);
	else
	  xtix   = linspace(0,n,n);
	 ytix   = linspace(2^(2+(oct-floor(log2(scale)))),n*2/scale,nscale);
	end
	
	if string(scaling)=='Individual',    //strcmp(scaling,'Individual'),
	    for k=1:nscale,

		amax  = max(rwt(:,k));
		amin = min(rwt(:,k));
		    rwt(:,k) = ((rwt(:,k))-amin) ./ (amax-amin) .*256;
		end
	else 
		amin = min(min(rwt));
	     amax = max(max((rwt)));
		rwt = (rwt+amax) ./ (2*amax) .*256;
	end
	
        if string(option)=='lin'   
        
	  mtlb_image(xtix,ytix, flipud(rwt'));
	  plot2d([0;1],[0;1],0);//axis('xy');
	else
	
	  mtlb_image(xtix,ytix, rwt');
          plot2d([0;1],[0;1],0);//axis('ij');
	  xtitle('','','log2(s)');
	  //xlabel('')
	  //ylabel('log2(s)')
	end
	str = mtlb_sprintf('colormap(1-%s(256))',colors);
	eval(str)
endfunction
//image

⌨️ 快捷键说明

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