function [ PDF_MxM_matrix, range ] = ComputeMxMPDF( coefficients, step_size, M ); coefficients = round( coefficients./step_size ); value_min = min( min( coefficients ) ); value_max = max( max( coefficients ) ); [ row_max, col_max ] = size( coefficients ); PDF_MxM_matrix = zeros( M.^2, value_max - value_min + 1 ); for row_offset = 1:M for col_offset = 1:M PDF = zeros( 1, value_max - value_min + 1 ); for row = row_offset:M:row_max for col = col_offset:M:col_max PDF( coefficients( row, col ) - value_min + 1 ) = PDF( coefficients( row, col ) - value_min + 1 ) + 1; end end PDF_MxM_matrix( (row_offset-1)*M+col_offset, : ) = PDF; end end PDF_MxM_matrix = PDF_MxM_matrix./(prod(size(coefficients))/M.^2); range = [ min( min( coefficients ) ), max( max( coefficients ) ) ];