2014-11-10 Masa-aki Sato Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function y = nonlinear_map(cmax,cmin,NX,mode) 0002 % 0003 % 2014-11-10 Masa-aki Sato 0004 % 0005 % Copyright (C) 2011, ATR All Rights Reserved. 0006 % License : New BSD License(see VBMEG_LICENSE.txt) 0007 0008 x = (1:NX)/NX; 0009 0010 switch mode 0011 case 'gauss' 0012 % cmin =cmax*exp(-(0.5)^2/sx) 0013 % log(cmin/cmax) = -(0.5)^2/sx 0014 sx = (0.5)^2/log(cmax/cmin); 0015 xc = mean(x); 0016 y = cmax*exp(-(x - xc).^2/sx); 0017 case 'exp' 0018 % cmin =cmax*exp(-1/sx) 0019 sx = 1/log(cmax/cmin); 0020 y = cmax*exp(-(1-x)/sx); 0021 end 0022 0023 y = round(y); 0024 y = max(y,cmin); 0025 y = min(y,cmax);