function [h] = solution_hw6_p4b(f, pArray)
% Given an image file f return the required approximate images.
%   f - File name of the image
%   pArray - Array of ranks to reduce to

    nP = length(pArray); % Number of ranks to use

    n = ceil((nP+1)/3);  % Number of rows needed for 3 columns. Need to include original image
    
    h = figure;
     
    subplot(n, 3, 1);
    imshow(f);
    title('Original');
    
    for i=1:nP
        img = solution_hw6_p4a(f, pArray(i));
        subplot(n, 3, i+1);
        imshow(img);
        title(sprintf('Rank = %d', pArray(i)));
    end



end

