disp('Running MATLAB script file SiCur1fig2.m') ;
%
%    Makes Figure 2 for the SIgnificance of CURvature paper
%
%    Copied from MatlabSoftware\Tests\sizerSMtest.m
%
%    This analyzes the Donoho Johnstone Blocks Data



pstr = 'SiCur1fig2' ;



figh = figure(1) ;
clf ;


%  Generate data
%
nobs = 1024 ;
xgrid = linspace(1/(2*nobs), 1 - (1/(2*nobs)), nobs)' ;

m = 4 * ones(nobs,1) ;
m = m - 2 * [zeros(200,1); ones(824,1)] ;
m = m + 1 * [zeros(500,1); ones(524,1)] ;
m = m - 2 * [zeros(724,1); ones(300,1)] ;


%  start old lines giving DJ Blocks
%
%idist = 4 ;
%
%%  Following lines are modifications of Sudeshna Adak's Gen_sign.m
%if idist == 1 ;
%  tarstr = 'Step' ;
%  m = 0.2 + 0.6*(xgrid > 1/3 & xgrid <= 0.75); 
%elseif idist == 2 ;
%  tarstr = 'Wave' ;
%  m = 0.5 + (0.2.*cos(4*pi*xgrid)) + (0.1.*cos(24*pi*xgrid));
%elseif idist == 3 ;
%  tarstr = 'Blip' ;
%   m = (0.32 + (0.6.*xgrid) + ...
%                  0.3*exp(-100*((xgrid-0.3).^2))).*(xgrid <= 0.8) + ...
%       (-0.28 + (0.6.*xgrid) + ... 
%                  0.3*exp(-100*((xgrid-1.3).^2))).*(xgrid > 0.8);
%elseif idist == 4 ;
%  tarstr = 'Blocks' ;
%  pos = [ .1 .13 .15 .23 .25 .40 .44 .65  .76 .78 .81];
%  hgt = [4 (-5) 3 (-4) 5 (-4.2) 2.1 4.3  (-3.1) 2.1 (-4.2)];
%  m = 2*ones(size(xgrid));
%  for j=1:length(pos)
%    m = m + (1 + sign(xgrid-pos(j))).*(hgt(j)/2) ;
%  end
%  m = (0.6/9.2)*m + 0.2;
%elseif idist == 5 ;
%  tarstr = 'Bumps' ;
%  pos = [ .1 .13 .15 .23 .25 .40 .44 .65  .76 .78 .81];
%  hgt = [ 4  5   3   4  5  4.2 2.1 4.3  3.1 5.1 4.2];
%  wth = [.005 .005 .006 .01 .01 .03 .01 .01  .005 .008 .005];
%  m = zeros(size(xgrid));
%  for j =1:length(pos)
%    m = m + hgt(j)./( 1 + abs((xgrid - pos(j))./wth(j))).^4;
%  end 
%  m = ((0.6/5.3437952)*m) + 0.2;
%elseif idist == 6 ;
%  tarstr = 'HeaviSine' ;
%  m = 4.*sin(4*pi.*xgrid) - sign(xgrid - .3) - sign(.72 - xgrid) + 5;
%  m = (0.6/9)*m + 0.2;
%elseif idist == 7 ;
%  tarstr = 'Doppler' ;
%  m = sqrt(xgrid.*(1-xgrid)).*sin((2*pi*1.05) ./(xgrid+.05)) + 0.5;
%  m = 0.6*m + 0.2;
%elseif idist == 8 ;
%  tarstr = 'Angles' ;
%  m = ((2*xgrid + 0.5).*(xgrid <= 0.15)) + ...
%    ((-12*(xgrid-0.15) + 0.8).*(xgrid > 0.15 & xgrid <= 0.2)) + ...
%    0.2*(xgrid > 0.2 & xgrid <= 0.5) + ...
%    ((6*(xgrid - 0.5) + 0.2).*(xgrid > 0.5 & xgrid <= 0.6)) + ...
%    ((-10*(xgrid - 0.6) + 0.8).*(xgrid > 0.6 & xgrid <= 0.65)) + ...
%    ((-0.5*(xgrid - 0.65) + 0.3).*(xgrid > 0.65 & xgrid <= 0.85)) + ...
%    ((2*(xgrid - 0.85) + 0.2).*(xgrid > 0.85));
%elseif idist == 9 ;
%  tarstr = 'Parabolas' ;
%  pos = [0.1 0.2 0.3 0.35 0.37 0.41 0.43 0.5 0.7 0.9];
%  hgt = [(-30) 60 (-30) 500 (-1000) 1000 (-500) 7.5 (-15) 7.5];
%  m = zeros(size(xgrid));
%  for j =1:length(pos)
%    m = m + hgt(j).*((xgrid-pos(j)).^2).*(xgrid > pos(j));
%  end
%  m = m + 0.8;
%elseif idist == 10 ;
%  tarstr = 'Time Shifted Sine' ;
%  u = xgrid;
%  for j =1:4,
%    u = 0.5*(1-cos(pi*u));
%  end
%  m = 0.3*sin(3*pi*(u+xgrid)) + 0.5;
%end ;
%
%sigstr = 'High Noise' ;
%sig = .1 ;
%
%  randn('seed',92394873) ;
%ydat = m + sig * randn(nobs,1) ;
%data = [xgrid, ydat] ; 

  randn('seed',92394873) ;
ydat = m + 0.5 * randn(nobs,1) ;
data = [xgrid, ydat] ; 




%  do SiZer analysis
%
paramstruct = struct('iout',2,...
                     'imovie',0,...
                     'hhighlight',0,...
                     'ibigdot',1,...
                     'famoltitle',[],...
                     'sizertitle',[],...
                     'curvsizertitle',[],...
                     'xlabelstr',['x'],...
                     'ylabelstr',['y'],...
                     'labelfontsize',12,...
                     'ibdryadj',0,...
                     'iscreenwrite',1) ;

sizerSM(data,paramstruct) ;





  orient portrait ;
  set(gcf,'PaperSize',[5.0, 9.0]) ; 
  set(gcf,'PaperPosition',[0.25, 0.25, 4.5, 8.5]) ; 
print('-dpsc', [pstr '.ps']) ;


