Beruflich Dokumente
Kultur Dokumente
But de TP :
Le but de ce TP est de faire un programme en Matlab en utilisant l’approximation des méthodes s pour obtenir la
solution de l’équation différentielle du circuit RC et RLC.
1. Circuit RC :
On a :
𝑅 = 10Ω , 𝐶 = 1.6 × 10 − 6𝐹
1.1. L’équation différencielle :
D'après la loi des mailles : 𝐸(𝑡) = 𝑅𝑖 + 𝑢(𝑡) ……… (1)
𝑖 = 𝑑𝑞/𝑑𝑡 𝑒𝑡 𝑞 = 𝐶 × 𝑢(𝑡)
𝑖 = 𝑑𝑞/𝑑𝑡 = 𝑑(𝐶 × 𝑢)/𝑑𝑡 𝑖 = 𝐶 × 𝑑𝑢/𝑑𝑡 ……… (2)
de (1) et (2) :
𝑑𝑋
𝐸(𝑡) = 𝑅𝐶 × 𝑑𝑢/𝑑𝑡 + 𝑢(𝑡) 𝜏. 𝑑𝑡 + 𝑋(𝑡) = 𝐸(𝑡)
1
TP Méthode numérique et optimisation Ahmouda Taha / Maamri Chouaib Option : MC
TP N° 03 Prof : allag.M 2018/2019
Le script: Le schéma :
%taylor(RC)
clc
clear all
R=10
C=1.6*10^-6
i=1
Tu=R*C
h=10^-6
U=220
X=0
t=0
tf=10*Tu
while t<=tf
f=(-1/Tu)*X+(1/Tu)*U
X=X+h*f+((h^2)/2)*(-1/Tu)*f
t=i*h
i=i+1
XX(i)=X
tt(i)=t
end
plot(tt,XX),grid
title('La solution par TAYLOR')
𝑑2 𝑢𝑐 𝑑𝑢𝐶
Avec 𝑖 = 𝐶 × 𝑑𝑢/𝑑𝑡 : 𝐿𝐶 + 𝑅𝐶 + 𝑢𝑐 = 𝐸𝑐𝑜𝑠𝜔𝑡
𝑑𝑡 2 𝑑𝑡
𝑑2 𝑢𝑐 𝑅 𝑑𝑢𝐶 𝑢𝐶 𝐸
On dévise sur LC : + + = 𝑐𝑜𝑠𝜔𝑡
𝑑𝑡 2 𝐿 𝑑𝑡 𝐿𝐶 𝐿𝐶
R=10;
W=2*pi*50;
C=200e-6;
t=0,Z1=0,Z2=0,h=10^-5,t0=0
ti=t0+i*h
tf=10^-4;i=0
while ti<tf
f1=Z2
f2=(E/(L*C))*cos(W*t)-(R/L)*Z2-(1/L*C)*Z1
Z1=Z1+h*f1
Z2=Z2+h*f2
ti=t0+i*h
i=i+1
ZZ1(i)=Z1
ZZ2(i)=Z2
tt(i)=ti
end
hold on
plot(tt,ZZ1),title('diagramme de EULER')
grid on
Le schéma :
diagramme de EULER
0.35
0.3
0.25
0.2
0.15
0.1
0.05
0
0 0.2 0.4 0.6 0.8 1 1.2
-4
x 10
4
2.2.2. La méthode de << Taylor >> :
Le script :
%tp3 Résolution d'équation différentielle Ordinaire
%methode de Taylor.
clc
clear all
E=5;
L=100e-6;
R=10;
W=2*pi*50;
C=200e-6;
t=0,Z1=0,Z2=0,h=10^-5,t0=0
ti=t0+i*h
tf=10^-4;i=0
while ti<tf
f1=Z2
f2=(E/(L*C))*cos(W*t)-(R/L)*Z2-(1/L*C)*Z1
Z1=Z1+h*f1+((h^2)/2)*f1
Z2=Z2+h*f2+(h^2)/2*(-E/(L*C)*W*sin(W*t)-(1/(L*C)*Z1)-(R/L)*f2)
ti=t0+i*h
i=i+1
ZZ1(i)=Z1
ZZ2(i)=Z2
tt(i)=ti
end
hold on
plot(tt,ZZ1),title('diagramme de taylor"z1"')
%plot(tt,ZZ2),title('diagramme de taylor" z2"')
grid on
Le schéma :
diagramme de taylor"z1"
0.35
0.3
0.25
0.2
0.15
0.1
0.05
0
0 0.2 0.4 0.6 0.8 1 1.2
-4
x 10
5
2.2.3. La méthode de << RK2 >> :
Le script :
%methode de RK2.
clc
clear all
E=5;
L=100e-6;
R=10;
W=2*pi*50;
C=200e-6;.
t=0,Z1=0,Z2=0,h=10^-5,t0=0
ti=t0+i*h
tf=10^-4;i=0
while ti<tf
f1=Z2
f2=(E/(L*C))*cos(W*t)-(R/L)*Z2-(1/L*C)*Z1
K11=f1
K21=f2
K12=(Z2+(h*K21))
K22=(E/(L*C))*cos(W*(t+h))-(R/L)*(Z2+(h*K21))-(1/L*C)*(Z1+(h*K11))
Z1=Z1+((h/2)*(K11+K12))
Z2=Z2+((h/2)*(K21+K22))
ti=t0+i*h
i=i+1
ZZ1(i)=Z1
ZZ2(i)=Z2
tt(i)=ti
end
%plot(tt,ZZ1,'b'),title('diagramme de RK2 "Z1"')
plot(tt,ZZ2),title('diagramme de RK2 "Z2"')
grid on
diagramme de RK2 "Z2"
2600
2400
2200
2000
1800
1600
1400
1200
0 0.2 0.4 0.6 0.8 1 1.2
-4
x 10
6
2.2.4. La méthode de << RK4 >> :
3. %methode de RK4. 22.
4. clc K23=(E/(L*C))*cos(W*(t+(h/2)))-
5. clear all (R/L)*(Z2+((h/2)*K22))-
(1/L*C)*(Z1+((h/2)*K12))
6. E=5;
23. K14=(Z2+(h*K23))
7. L=100e-6;
24. K24=(E/(L*C))*cos(W*(t+h))-
8. R=10; (R/L)*(Z2+(h*K23))-
9. W=2*pi*50; (1/L*C)*(Z1+(h*K13))
10. C=200e-6; 25.
11. t=0,Z1=0,Z2=0,h=10^-5,t0=0 Z1=Z1+((h/6)*(K11+2*K12+2*K13+K14))
12. ti=t0+i*h 26.
13. tf=10^-4;i=0 Z2=Z2+((h/6)*(K21+2*K22+2*K23+K24))
14. while ti<tf 27. ti=t0+i*h
15. f1=Z2 28. i=i+1
16. f2=(E/(L*C))*cos(W*t)- 29. ZZ1(i)=Z1
(R/L)*Z2-(1/L*C)*Z1 30. ZZ2(i)=Z2
17. K11=f1 31. tt(i)=ti
18. K21=f2 32. end
19. K12=(Z2+((h/2)*K21)) 33. %plot(tt,ZZ1),title('diagramme de
20. RK4 "Z1"')
K22=(E/(L*C))*cos(W*(t+(h/2)))- 34. plot(tt,ZZ2),title('diagramme de
(R/L)*(Z2+((h/2)*K21))- RK4 "Z2"')
(1/(L*C))*(Z1+((h/2)*K11)) 35. grid on
21. K13=(Z2+((h/2)*K22))
2400
2200
2000
1800
1600
1400
1200
0 0.2 0.4 0.6 0.8 1 1.2
-4
x 10