%% Specify Polynomial Ordering in Discrete-Time Transfer Function
% For this example, specify polynomial ordering in discrete-time transfer function models using the 'Variable' property.
% Consider the following discrete-time transfer functions with sample time 0.1 seconds:
% sys1(z)=\frac{z^2}{z^2+2z+3}\;\;\;\;\;\;\;\;\;\;\;\;sys2(z^{-1})=\frac{1}{1+2z^{-1}+3z^{-2}}.
% Create the first discrete-time transfer function by specifying the z coefficients.

numerator = [1,0,0];
denominator = [1,2,3];
ts = 0.1;
sys1 = tf(numerator,denominator,ts)

% The coefficients of sys1 are ordered in descending powers of z.
%
% tf switches convention based on the value of the 'Variable' property. Since sys2 is the inverse transfer function model of sys1, specify 'Variable' as 'z^-1' and use the same numerator and denominator coefficients.

sys2 = tf(numerator,denominator,ts,'Variable','z^-1')

% The coefficients of sys2 are now ordered in ascending powers of z^-1.
% Based on different conventions, you can specify polynomial ordering in transfer function models using the 'Variable' property.
% Copyright 2018 The MathWorks, Inc.