1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| clear all
Ue=3.335E4
Ve=5.890E2
Se=1.652E1
Wsce=-1.165E1
Wscd=-8.092E0
Wso=-2.041E1
Ud=4.546E4
Vd=1.846E3
Sd=2.902E1
cpx(1)=0.8023
opx(1)=0.0805
R=8.3146
tol=1e-6
P=1.5
T=1273
for i=2:20
F1=Ue+P*Ve-Se*T+R*T*log((1-cpx(i-1))/(1-opx(i-1)))-(cpx(i-1))^2*T*Wsce-2*(cpx(i-1))^2*(1-cpx(i-1))*T*(Wscd-Wsce)-(opx(i-1))^2*(-Wso*T);
F2=Ud+Vd*P-Sd*T+R*T*log(opx(i-1)/cpx(i-1))+(1-cpx(i-1))^2*T*Wscd+2*(1-cpx(i-1))^2*cpx(i-1)*T*(Wsce-Wscd)+(1-opx(i-1))^2*(-Wso*T);
f=[F1;F2];
dF1_cpx=(-R*T)/(1-cpx(i-1))-2*cpx(i-1)*T*Wsce-4*cpx(i-1)*(1-cpx(i-1))*T*(Wscd-Wsce)+2*(cpx(i-1))^2*T*(Wscd-Wsce);
dF1_opx=(R*T)/(1-opx(i-1))-2*opx(i-1)*(-Wso*T);
dF2_cpx=(-R*T)/cpx(i-1)-2*(1-cpx(i-1))*T*Wscd-4*(1-cpx(i-1))*cpx(i-1)*T*(Wsce-Wscd)+2*(1-cpx(i-1))^2*T*(Wsce-Wscd);
dF2_opx=(R*T)/opx(i-1)-2*(1-opx(i-1))*(-Wso*T);
df=[dF1_cpx,dF1_opx,dF2_cpx,dF2_opx];
J=inv([dF1_cpx,dF1_opx;dF2_cpx,dF2_opx]);
%les solutions
xy=[cpx(i-1) opx(i-1)]'-J*[F1,F2]';
cpx(i)=xy(1)
opx(i)=xy(2)
donnees=[cpx;opx]'
end |
Partager