P=[3 6 7 5;8 5 2 9;8 3 9 7]; alpha=0; [optimValue, optimPath]=myPlateauPass(P, alpha); fprintf('optimValue=%g\n', optimValue); fprintf('optimPath=%s\n', mat2str(optimPath)); % Plotting [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