%% Header
% Purpose:	Cost function
% Author:   Axel Lodemel Holene
% E-mail:	axel.holene@gmail.com
% Date:     February 2013
% About:    J = [Jw_y Jw_d]*[IAE_y IAE_d]./[IAEw_y IAEw_d]
%           ctrl =          struct of controller starting points
%           Jweights   ([Jw_y Jw_d])       Cost function weights
%           IAEweights ([IAEw_y IAEw_d])           IAE weighting

function J = costFun(ctrl, parm)
    iae0 = iae(ctrl,parm) ;
    J = parm.Jweights*(iae0./parm.IAEweights) ;
end