load pfMat.mat pfMat(1:20, :)=0; P=pfMat; alpha=10000; tic [optimValue, optimPath]=myPlateauPass(P, alpha); fprintf('optimValue=%g\n', optimValue); fprintf('optimPath=%s\n', mat2str(optimPath)); toc % Plotting subplot(2,1,1); [m, n]=size(P); imagesc(1:n, 1:m, P); axis image; shading flat; colorbar title('Plateau'); for i=1:n line(i, optimPath(i), 'color', 'k', 'marker', '.'); end subplot(2,1,2); mesh(1:n, 1:m, P); axis ij; axis tight; colorbar; box on for i=1:n line(i, optimPath(i), P(optimPath(i), i), 'color', 'k', 'marker', '.'); end title('Opt. path over the plateau');