% The matrix of flow equations for the rigid flow 
% the components are [Kc vc y Db Df w M L]

function dA = rigdSu2InvMatrix1(l,A1)
    A = real(A1);
    Kc = A(1); vc = A(2); y = A(3); Db = A(4); w = A(5); lambda = A(6); L = A(7);
    vf = 1;
    
    Fb = 1./sqrt((1-exp(-w)));
    gb = 1 + (2./w)*log(1+1./Fb);
    I1 = Iw1(-l,w);
    I2 = IM1(-l,w);
        
    r1 = (vf/vc)^(2-Kc);
    r2 = (vf/vc)^(-Kc);
    r3 = 1+(1/Kc^2);
    r4 = 1-(1/Kc^2);
    
    zKc = Fb-0.5*r1*r3*(Fb+(1-Kc-(3/2)*y)*gb);
    zvc = Fb+0.5*r1*r4*(Fb+(1-Kc-(3/2)*y)*gb);
    zy  = Fb-r2*(Fb+(1-Kc+0.5*y)*gb);
    zw  = 0.25*(r1*r4*Kc+r2*y);
    
    dKc = 0.5*(vc/vf)*(Kc^2)*Db*zKc;
    dvc = 0.5*(Kc/vf)*(vc^2)*Db*zvc;
    dy  = y^2 + Db*zy;
    dDb = -(2-Kc-(3/2)*y)*Db;
    dw  = -w - L*Db*(1-cosh(w))*(Fb.^3)*(1+zw)-L*Db*(1-Kc-(3/2)*y)*zw*w*I1;
    dlambda  = lambda*L*Db*(((1-cosh(w))/w)+sinh(w))*(Fb.^3)*(1+zw)+lambda*L*Db*(1-Kc-(3/2)*y)*zw*I2;
    dL  = L;
    
    params = [l w]

dA = [dKc; dvc; dy; dDb; dw; ; dlambda; dL];

  

