function [y,x] = lsim(PID,u,t,x0,InterpRule) %#ok<INUSL>
% Linear response simulation of PID.

%   Author(s): Rong Chen
%   Copyright 2009-2011 The MathWorks, Inc.

% Computability
if ~isproper(PID)
    ctrlMsgUtils.error('Control:general:NotSupportedImproperSys','lsim')
end
% Simulate
if PID.Ts==0
    y = lsim(ss(PID),u,t,[],InterpRule);
else
    % get num and den vectors based on Ts and discretization methods
    [Num, Pole] = getTF(PID);
    Den = poly(Pole);
    % Simulate
    InitState = ltipack.tfsimIC({Num},{Den},0);
    y = tfsim({Num},{Den},0,u,InitState);
end
x = [];
