function TFData = tf(PID)
% Conversion to @tfdata

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

% Compute numerator and poles based on Ts and discretization methods
[Num1,Num2,Pole1,Pole2] = getTF(PID);
% Compute denominator
Den1 = poly(Pole1);
Den2 = poly(Pole2);
Den1 = [zeros(1,length(Num1)-length(Den1)) Den1];
Den2 = [zeros(1,length(Num2)-length(Den2)) Den2];
% Remove any leading zeros
[Num,Den] = ltipack.tfdata.utTrimNumDen({Num1,Num2},{Den1,Den2},false);
% Return tfdata object (note that tfdata takes cell array)
TFData = ltipack.tfdata(Num,Den,PID.Ts);
