Travaux pratiques de m - PowerPoint PPT Presentation

About This Presentation
Title:

Travaux pratiques de m

Description:

Premier affichage %Allocation m moire. x=zeros(3,1); y=zeros(3,1) ... Pr paration session graphique et premier affichage. p=plot(x,y,'EraseMode','none'); q=plot ... – PowerPoint PPT presentation

Number of Views:73
Avg rating:3.0/5.0
Slides: 47
Provided by: sma55
Category:

less

Transcript and Presenter's Notes

Title: Travaux pratiques de m


1
Travaux pratiques de mécanique analytiqueSimula
tion en temps réel du mouvement dun pendule
double
2
Mise en situation...
Positions
Point A (l sin q, -l
cos q)
Point B (l.(sin q sin f ), -l.(cos
q cos f))
Vitesses
Point A (l dq/dt cos q, l dq/dt
sin q)
Point B (l.(dq/dt cos q df/dt cos f),
l.( dq/dt sin q
df/dt sin f ))
m g l 1 m l2 1
3
Lagrange (1)
L T - V
pour toute les masses du système
vitesse scalaire de la masse condidérée
4
Lagrange (2)
5
Système différentiel
6
Fonction différentielle ODE45
7
Définition des vecteurs utilisés
8
Définition des vecteurs utilisés
9
Fonction de dérivation
function dy dp ( t, y )
10
Variables temporaires
function dy dp ( t, y )
11
Mise en correspondance
function dy dp ( t, y )
dy(1) y(2)
12
Mise en correspondance
function dy dp ( t, y )
dy(1) y(2)
dy(3) y(4)
13
Mise en correspondance
function dy dp ( t, y )
dy(1) y(2)
dy(3) y(4)
dy(2)
14
Search and replace
function dy dp ( t, y )
s sin( ? - ? )
c cos( ? - ? )
dy(1) y(2)
dy(3) y(4)
dy(2)
15
Search and replace
function dy dp ( t, y )
s sin( ? - ? )
c cos( ? - ? )
dy(1) y(2)
dy(3) y(4)
dy(2)
16
Search and replace
function dy dp ( t, y )
s sin( ? - ? )
c cos( ? - ? )
dy(1) y(2)
dy(3) y(4)
dy(2)
17
Search and replace
function dy dp ( t, y )
s sin( y(1) - ? )
c cos(y(1) - ? )
dy(1) y(2)
dy(3) y(4)
dy(2)
18
Search and replace
function dy dp ( t, y )
s sin( y(1) - y(3) )
c cos(y(1) - y(3) )
dy(1) y(2)
dy(3) y(4)
dy(2)
19
Search and replace
function dy dp ( t, y )
s sin( y(1) - y(3) )
c cos(y(1) - y(3) )
dy(1) y(2)
dy(3) y(4)
dy(2)
20
Search and replace
function dy dp ( t, y )
s sin( y(1) - y(3) )
c cos(y(1) - y(3) )
dy(1) y(2)
dy(3) y(4)
dy(2)
21
Search and replace
function dy dp ( t, y )
s sin( y(1) - y(3) )
c cos(y(1) - y(3) )
dy(1) y(2)
dy(3) y(4)
dy(2)
22
Search and replace
function dy dp ( t, y )
s sin( y(1) - y(3) )
c cos(y(1) - y(3) )
dy(1) y(2)
dy(3) y(4)
23
Fonction différentielle ODE45
function dy dp ( t, y )
s sin( y(1) - y(3) )
c cos(y(1) - y(3) )
dy(1) y(2)
dy(3) y(4)
24
Résolution numérique
25
Variables utilisées
26
Premier affichage
27
Boucle daffichage
Boucle d'affichage for i11000
x(2)10sin(angle(i,1)) y(2)-10cos(angle(i,1
)) x(3)x(2)10sin(angle(i,3))
y(3)y(2)-10cos(angle(i,3))
line(x,y,'LineWidth',2) end
28
Gestion dynamique
Boucle d'affichage for i1100
x(2)10sin(angle(i,1)) y(2)-10cos(angle(i,1
)) x(3)x(2)10sin(angle(i,3))
y(3)y(2)-10cos(angle(i,3)) clf
axis(-30 30 -30 30) line(x,y,'LineWidth',2)
drawnow
29
Temps réel
Boucle d'affichage for i1100 tic
x(2)10sin(angle(i,1)) y(2)-10cos(angle(i,
1)) x(3)x(2)10sin(angle(i,3))
y(3)y(2)-10cos(angle(i,3)) while
toclt0.1 end clf axis(-30 30 -30
30) line(x,y,'LineWidth',2) drawnow
end
30
Gestion anciennes positions
Allocation mémoire xoldzeros(3,1) yoldzeros(3,
1)
Boucle d'affichage for i1100 tic
xold(2)x(2) yold(2)y(2) xold(3)x(3)
yold(3)y(3) x(2)10sin(angle(i,1))
y(2)-10cos(angle(i,1)) x(3)x(2)10sin(ang
le(i,3)) y(3)y(2)-10cos(angle(i,3))
while toclt0.1 end
plot(xold,yold,'w','LineWidth',2) plot(x,y,'LineW
idth',2) drawnow end
31
Approche orienté-objet
Objet graphique
Adresse
32
Approche orienté-objet
Objet graphique
Adresse
XData
YData
ZData
Color
Style
plot
axis
33
Récupération de ladresse
graph1plot(x,y,'w','EraseMode','none')
Objet graphique
Adresse
1.05684523 graph1
XData
YData
ZData
Color
Style
Instruction
34
Données en x
graph1plot(x,y,'w','EraseMode','none')
Objet graphique
Adresse
1.05684523 graph1
XData
x
YData
ZData
Color
Style
Instruction
35
Données en y
graph1plot(x,y,'w','EraseMode','none')
Adresse
1.05684523 graph1
XData
x
YData
y
ZData
Color
Style
Instruction
36
Pas de données en z
graph1plot(x,y,'w','EraseMode','none')
Objet graphique
Adresse
1.05684523 graph1
XData
x
YData
y
ZData
Color
Style
Instruction
37
Couleur
graph1plot(x,y,'w','EraseMode','none')
Objet graphique
Adresse
1.05684523 graph1
XData
x
YData
y
ZData
Color
w
Style
Instruction
38
Style
graph1plot(x,y,'w','EraseMode','none')
Objet graphique
Adresse
1.05684523 graph1
XData
x
YData
y
ZData
Color
w
Style

Instruction
39
Variable privée
graph1plot(x,y,'w','EraseMode','none')
Objet graphique
Adresse
1.05684523 graph1
XData
x
YData
y
ZData
Color
w
Style

EraseMode none
Instruction
40
Instruction graphique
graph1plot(x,y,'w','EraseMode','none')
Objet graphique
Adresse
1.05684523 graph1
XData
x
YData
y
ZData
Color
w
Style

EraseMode none
Instruction
plot
41
Accès variables membres
set(graph1,'XData',xnew,'YData',ynew,'LineWidth',2
)
graph1
XData
YData
42
Modification données en x
set(graph1,'XData',xnew,'YData',ynew,'LineWidth',2
)
graph1
XData
xnew
YData
43
Modification données en y
set(graph1,'XData',xnew,'YData',ynew,'LineWidth',2
)
graph1
XData
xnew
YData
ynew
44
Modification paramètres divers
set(graph1,'XData',xnew,'YData',ynew,'LineWidth',2
)
graph1
XData
xnew
YData
ynew
45
Pour notre problème
46
Approche orienté-objet
Write a Comment
User Comments (0)
About PowerShow.com