%% Header
% Purpose:  Using the half-rule to reduce second order tfs to 
%           first order tfs
% Author:   Axel Lodemel Holene.
% E-mail:   axel.holene@gmail.com
% Date:     March 2013
% About:    G: second order model
%           H: reduced first order model

function H = halfrule(G)
    s = zpk('s') ;
    if G.case > 9           % No half rule for 1st order systems
        H = G ;
    else
        H.ordG = G ;
        H.k = G.k ;
        H.tau1 = G.tau1 + G.tau2/2 ;
        H.theta = G.theta + G.tau2/2 ;
        H.tfnd = H.k/(H.tau1*s + 1) ;
        H.tf = H.tfnd*exp(-H.theta*s) ;
    end
end