function y = nnpin(x,a,b,q)
%NNPIN Neural Network Design utility function.

%	NNPIN(X,A,B,Q)
%	  X - Number or matrix.
%	  A - Lower bound.
%	  B - Upper bound.
%	  Q - Quantization constant (optional).
%	Returns values in X pinned into the interval defined
%	by A and B and rounded to the nearest multiple of Q.

% Copyright (c) 1992-1998 by PWS Publishing Company and The MathWorks, Inc.
% $Revision: 1.3 $
% First Version, 8-31-95.

%==================================================================

y = max(a,min(b,x));
y = round(y/q)*q;
