MATLAB: Are inconsistent results generated by evalfr and freqresp, as compared to dcgain for a single input multiple output system for state-space representations

Control System Toolbox

The following sequence produces inconsistent results when using evalfr, dcgain and freqresp:
s = tf('s');
% define a 2x1 G(s) with a pole in the origin in the (1,1) element
% and the (2,1) element equal to zero
G = [1/s; 0];
sys = ss(G); % the realization is minimal
evalfr(G,0) % the results is [inf;0], which is correct
evalfr(sys,0) % the result is [inf;inf], which is incorrect
evalfr(sys(2,1),0) % the result is inf, which is incorrect (it should be 0)
evalfr(tf(sys),0) % the result is [inf;0], which is correct

dcgain(sys) % the result is [inf;0], which is correct
gain=freqresp(sys,0) % the result is gain = [inf;inf], which is incorrect
The response to the transfer function zero should ideally be zero, as reflected correctly by the output of "dcgain". Why does "evalfr" and "freqresp" output Inf?

Best Answer

The system "G" in the code is a single-input multiple-output (SIMO), which affects the state-space representation. If a single-input single-output (SISO) system has a transfer function that is zero, its frequency response can be calculated using the following line of code:
>> evalfr(ss(G(2,1)),0)
ans =
0
In the case above, the output is as expected because state-space coefficients are calculated only for the transfer function zero. 
>> ss(G(2,1))
ans =
D =
u1
y1 0
However in the SIMO case, the state-space model calculates a state for the overall system based on the two transfer functions G(1,1) and G(2,1). Therefore even though the transfer function G(2,1) is zero, there is a pole at s=0. The coefficient B in this case is 1. It implies that even though the output is zero, the state grows, even though the output is zero. This can be validated with the following line of code:
>> ss(G(2,1))
In summary the following two implementations are not the same:
1) >> evalfr(ss(G(2,1)),0)
2) >> evalfr(sys(2,1),0) %(where sys=ss(G))
That is:
>> isequal(evalfr(ss(G(2,1)),0),evalfr(sys(2,1),0))
ans =
logical
0
Even if we try and determine the frequency response using basic MATLAB, it does not return the result you are expecting.
>> [a,b,c,d] = ssdata(sys);
>> -c * (a\b)
ans = Inf NaN
>> -(c/a)*b
ans = Inf NaN
A state-space-based evaluation of freqresp(sys,0) will not give zero as (2,1) entry because it involves 0/0 or 0*Inf forms. Another way to look at this is that the value “zero” has infinite sensitivity. Any o(eps) perturbation of the C matrix will turn zero into Inf.
The reason "dcgain" gives the expected result is that it channelizes the two transfer functions and treats them as different inputs. "dcgain" does more work to eliminate cancelling terms. But it is not efficient to do this in general for "freqresp".