function [NoFeedThrough, FeedThroughPair] = mpc_checkdirectfeedthrough(sys, mvindex)
% Check for direct feedthrough from manipulated variables to all the
% outputs.
%
%   sys:        a single MIMO TF/ZPK/SS system
%   mvindex:    a vector of MV indices
%
%   NoFeedThrough = true:
%       when there is no direct feedthrough in any pair of i/o channel. 
%       FeedThroughPair are all false.
%   NoFeedThrough = false:
%       when there is at least one direct feedthrough channel. 
%       FeedThroughPair(i,j) = true when the (i,j) channel has direct feedthrough.

%	Author:  Rong Chen
%	Copyright 2012-2013 The MathWorks, Inc.

D = evalfr(sys(:,mvindex), inf);
FeedThroughPair = (D~=0);  % I/O pair
NoFeedThrough = (norm(D,1)==0);  % overall
