function demo156_2

disp('Compute scattering from a barrier top potential');

close all;

xx = [-2, 0, 2];
VV = [0 , 0, 1, 0, 0];

hs = 1 ./ [1 : 14];
dats = [];
figure('units','normalized','outerposition',[0 0 1 1]);
for jj = 1:length(hs)
    
  elt = spline_well(xx,VV);
  elt2 = spline_well(xx,VV / (hs(jj) * hs(jj)));
  res = checked_resonances(elt2, 0, 1e-3) * hs(jj);
  dats = [dats, min(-imag(res))];
  
  subplot('Position', [0.05, 0.55, 0.9, 0.4]);
  hold off;
  plot_potential(elt);
  set(gca, 'YLim', [-0.1, 1.1]);
  hold on;
  plot([-2, 2], [VV(3), VV(3)], 'g--');
  subplot('Position', [0.05, 0.05, 0.9, 0.4]);
  hold off;
  plot(res, 'b*');
  hold on;
  title(['h = 1 / ', int2str(1 / hs(jj))]);
  set(gca, 'YLim', [-2, 0]);
  set(gca, 'XLim', [-2, 2]);
  plot([sqrt(VV(3)), sqrt(VV(3))], [-2, 0], 'g--');
  plot([-sqrt(VV(3)), -sqrt(VV(3))], [-2, 0], 'g--');
  pause(1);
end

figure;
plot(1 ./ hs, 1 ./ dats, 'b-*');
xlabel('1 / h');
ylabel('1 / im part of highest resonance');

end