Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

TAREA 17

Modelado por Lagrange (2 Grados de


Libertad)

Condiciones Iniciales

In[1]:= Clear[m1, m2, g, l1, x1, θ1, v1, ω1]


CondIni = {x1[0] ⩵ 0, θ1[0] ⩵ 10 °, x1 '[0] ⩵ 0, θ1 '[0] ⩵ 0}

Solución No Lineal

In[3]:= v1[t] + l1 ω1[t] Cos[θ1[t]]2 + l1 ω1[t] Sin[θ1[t]]2 // Expand

In[4]:= v1[t] + l1 ω1[t] Cos[θ1[t]]2 + l1 ω1[t] Sin[θ1[t]]2 // FullSimplify


1
In[5]:= T1 = m1 v1[t]2 // FullSimplify
2
1
T2 = m2 v1[t] + l1 ω1[t] Cos[θ1[t]]2 + l1 ω1[t] Sin[θ1[t]]2  // FullSimplify
2
T = T1 + T2

In[8]:= V = - m2 g l1 Cos[θ1[t]]

In[9]:= L = T-V

In[10]:= ∂x1[t] L
∂v1[t] L
∂t ∂v1[t] L

In[13]:= ∂θ1[t] L
∂ω1[t] L
∂t ∂ω1[t] L
2 Tarea 17 Lagrange en dos grados de libertad.nb

In[16]:= Ec1 = ∂t ∂v1[t] L - ∂x1[t] L ⩵ 0

In[17]:= Ec2 = ∂t ∂ω1[t] L - ∂θ1[t] L ⩵ 0

In[18]:= Ec1A = Ec1 /. v1[t] → x1 '[t] /. v1 '[t] → x1 ''[t] /. ω1[t] → θ1 '[t] /.


ω1 '[t] → θ1 ''[t] // Expand
Ec2A = Ec2 /. v1[t] → x1 '[t] /. v1 '[t] → x1 ''[t] /. ω1[t] → θ1 '[t] /.
ω1 '[t] → θ1 ''[t] // Expand

Datos

In[20]:= m1 = 1;
m2 = 1;
l1 = 1;
g = 9.81;

Solución

In[24]:= Ec1A
Ec2A

In[26]:= Sol1 = NDSolve[{Ec1A, Ec2A, CondIni}, {x1[t], θ1[t]}, {t, 0, 100}]


x1Sol = x1[t] /. Sol1[[1]]
θ1Sol = θ1[t] /. Sol1[[1]]

In[29]:= Plot[x1Sol, {t, 0, 10}]


Plot[θ1Sol, {t, 0, 10}]

Solución Lineal
Si se considera :
θ1 << 1
Sin[θ1] → θ1
θ13 θ15 θ17
Sin[θ1] → θ1 - + - + ...
3! 5! 7!
Cos[θ1] → 1
θ12 θ14 θ16
Cos[θ1] → 1 - + - + ...
2! 4! 6!
In[31]:= Clear[m1, m2, l1, g]
T1 // Expand
T2 // Expand

In[34]:= T2 /. Cos[θ1[t]] → 1 // FullSimplify

In[35]:= TLin = T1 + FullSimplify[T2 /. Cos[θ1[t]] → 1]


Tarea 17 Lagrange en dos grados de libertad.nb 3

θ1[t]3 θ1[t]2
In[36]:= VLin = V /. Sin[θ1[t]] → θ1[t] - , Cos[θ1[t]] → 1 - 
3! 2!

In[37]:= LLin = TLin - VLin

In[38]:= ∂x1[t] LLin


∂v1[t] LLin
∂t ∂v1[t] LLin

In[41]:= ∂θ1[t] LLin


∂ω1[t] LLin
∂t ∂ω1[t] LLin

In[44]:= Ec1L = ∂t ∂v1[t] LLin - ∂x1[t] LLin ⩵ 0

In[45]:= Ec2L = ∂t ∂ω1[t] LLin - ∂θ1[t] LLin ⩵ 0

In[46]:= Ec1B = Ec1L /. v1[t] → x1 '[t] /. v1 '[t] → x1 ''[t] /. ω1[t] → θ1 '[t] /.


ω1 '[t] → θ1 ''[t] // Expand
Ec2B = Ec2L /. v1[t] → x1 '[t] /. v1 '[t] → x1 ''[t] /. ω1[t] → θ1 '[t] /.
ω1 '[t] → θ1 ''[t] // Expand

In[48]:= MatM = l1 m2, l12 m2, {m1 + m2, l1 m2};


MatK = {{0, g l1 m2}, {0, 0}};
MatM // MatrixForm
MatK // MatrixForm

In[52]:= MatDin = Inverse[MatM].MatK;


MatDin // MatrixForm

In[54]:= {λ1, λ2} = Eigenvalues[MatDin]


{Vp1, Vp2} = Eigenvectors[MatDin]
Eigensystem[MatDin]

Datos

In[57]:= m1 = 1;
m2 = 1;
l1 = 1;
g = 9.81;
4 Tarea 17 Lagrange en dos grados de libertad.nb

Solución

In[61]:= λ1
λ2
ω1 = λ1
ω2 = λ2
Vp1
Vp2

In[67]:= Ec1B
Ec2B

In[69]:= Sol2 = NDSolve[{Ec1B, Ec2B, CondIni}, {x1[t], θ1[t]}, {t, 0, 100}]


x2Sol = x1[t] /. Sol2[[1]]
θ2Sol = θ1[t] /. Sol2[[1]]

In[72]:= Plot[{x1Sol, x2Sol}, {t, 0, 10}, PlotStyle → {Blue, {Red, Dashed}}]


Plot[{θ1Sol, θ2Sol}, {t, 0, 10}, PlotStyle → {Blue, {Red, Dashed}}]

You might also like