% code to calculate steady state from linear model
% cv controlled, mv manipulated, id = idv, K gain matrix 41x19
% u=ss valves, zs=ss meas, siz = fraction of disturbance
function [ss,uu]=sscal(cv,mv,K,id,u,zs,siz)

% Unscale gain matrix
K(:,1:12)=K(:,1:12)./[ones(41,1)*u'];
K=K.*[zs*ones(1,19)];

uu=-inv(K(cv,mv))*K(cv,id+12)*siz;

ss=K(:,mv)*uu+K(:,id+12)*siz+zs;

