Get["../simulin/simulineaire.m"];

doubleT[r_,c_,gc_]:=Module[{n,A,B},
    n=5;
    A=Table[0,{n},{n}];
    B=Table[0,{n}];
    A=ajouterResistance[A,1,2,r];
    A=ajouterResistance[A,2,4,r];
    A=ajouterResistance[A,3,5,r/2];
    A=ajouterCapacite[A,1,3,c];
    A=ajouterCapacite[A,3,4,c];
    A=ajouterCapacite[A,2,5,2*c];
    A=ajouterDipole[A,4,5,gc];
    {A,B}=ajouterMasse[A,B,5];
    {A,B}=definirEntree[A,B,1];
    Return[{A,B}];
]
            

{A,B}=doubleT[R,C,0];
H=transfert[A,B,4]/.{s->I*omega}
            

fc=50;
r=10^2;
c=1/(2*N[Pi]*r*fc)
            
 
{A,B}=doubleT[r,c,0];
h=transfert[A,B,4];
            
bodeGain[h,0,4,-60,0]
bodePhase[h,0,4]

{A,B}=doubleT[r,c,10^9];
v=LinearSolve[A,-B];
icc=1/r*(v[[2]]-v[[4]])+c*s*(v[[3]]-v[[4]]);
icc=Abs[icc/.s->I*2*N[Pi]*100]
        
