%% Remainder After Division for Positive and Negative Values
% Find the remainder after division for a set of integers including both positive and negative values. Note that nonzero results have the same sign as the dividend.

a = [-4 -1 7 9];
b = 3;
r = rem(a,b)

% Copyright 2012 The MathWorks, Inc.