% State space model for rolling mill 

% Author:  Lars Malcolm Pedersen
% Version: 1
% Date: september 4th 1995


% Initialization

clear


% Parameters

  beta1 = 0.911;
  beta2 = 1.56; 
  EI = 5.3e4;
  rhoA = 0.2;
  K  = 4.10e4;
  am1 = 5e4;
  am2 = 2e2;
  rho = 1e-4;
  epsilon = 50;
  gamma = 0.566; 

answer = input('Do you want asymmetric harndess conditions? (1=yes, 0=no): ');

% Matrices

  beta = [beta1^4 0;
            0 beta2^4];

  Gamma1 = [1/rhoA,answer*gamma;
            answer*gamma,1/rhoA];

  Gamma2 = beta/rhoA;

  Gamma3 = [-1.64, -1.64;
            -0.629, 0.629];

  Gamma4 = [ 0   , 0;
            -2.87, 2.87];

  Phi = [-1.49,-2.13;
         -1.49, 2.13];

  Kab =   [ 7.69e-1, 2.31e-1;
            2.31e-1, 7.69e-1];

  A = [-am2/rhoA*eye(2),eye(2),zeros(2,2);
       -am1*Gamma1-EI*Gamma2,zeros(2,2),EI*(beta*Gamma3-Gamma4);
        zeros(2,4),-epsilon*eye(2)];

  B = [ zeros(4,2);
        eye(2)];

  C = 2*[Phi,zeros(2,2),(Kab-rhoA*Phi*Gamma3)];

  D = zeros(2,2);

end
