%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function sample_quarter() : Reduces a matrix by 1/4. % Even numbered rows are removed. % Odd numbered columns are removed. % INPUT : m x n matrix. % OUTPUT: m/2 x n/2 matrix % CALLS : sample_half.m (http://www.edcenter.sdsu.edu/projects/vrml/sample_half.txt) % Author: Jason Tate June 10, 1998 % tate@edcenter.sdsu.edu % % Educational Center for Computational Science & Engineering % http://www.edcenter.sdsu.edu %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function sampled = sample_quarter(ElevationMatrix) % DETERMINE DIMENSIONS OF MATRIX Dimensions = size(ElevationMatrix); numRows = Dimensions(1); numColumns = Dimensions(2); % INIT 'SAMPLED' MATRIX sampled = zeros(floor(numRows/2),floor(numColumns/2) ); % REDUCE BY HALF temp = sample_half(ElevationMatrix); sampled_index = 1; for i = 1:numRows % SAMPLE ODD NUMBERED ROWS if (mod(i,2) == 1) sampled(sampled_index,:) = temp(i,:); sampled_index = sampled_index + 1; end end