%% 1d Shroedinger eigenvalue problem (Sturm-Liouville)

pot = @(x) 1 ./ cosh(x-3).^2;

rhs = @(x, y, lambda) [y(2); (pot(x) - lambda)*y(1)];


for lambda = linspace(0,1.32,200),
    [T, Y] = ode45(@(x, y) rhs(x, y, lambda), [0, 10], [0; 1]);
    plot(T, Y(:,1)/max(abs(Y(:,1))), [0 6], [0 0], 'k-');
    axis([0, 10, -1, 1]);
    grid on;
    drawnow();
end;