Apps

* %list list-~~page~~% [[~~Attach:pendulum_mhe.zip~~ | ~~Download ~~MATLAB Pendulum Example]]~~ ~~
~~Attach:download.jpg~~ [[Attach:pendulum_mhe.zip | Download MATLAB Pendulum Example]]

* %list list-page% [[Attach:pendulum_mhe.zip | Download MATLAB Pendulum Example]]

The mass and length of a pendulum can be determined by tracking the horizontal position of the pendulum (x). The following is a MATLAB script (pendulum.m) that runs the Index-3 DAE through a series of simulations. As additional data is collected, the model predictions are adjusted to match the observed measurements. The starting values for mass are 1 kg and a length of 1 m.

Attach:download.jpg [[Attach:pendulum_mhe.zip | Download MATLAB Pendulum Example]]

The technique for aligning measured and model values is termed Moving Horizon Estimation. This is a technique for parameter estimation with differential and algebraic equation models. In this case there is no steady state data available. The mass and length can be determined by observing the time series of horizontal positions.

## Pendulum Motion

## Apps.PendulumMotion History

Hide minor edits - Show changes to output

Changed lines 42-43 from:

to:

* %list list-blogroll% [[Main/MATLAB | MATLAB Pendulum Example]]

Changed lines 37-38 from:

* %list list-page% (:html:)<a href="/online/plot.php?d=pendulum&f=~~pend~~.x.xml">Vertical Motion</a>(:htmlend:)

* %list list-page% (:html:)<a href="/online/plot.php?d=pendulum&f=~~pend~~.y.xml">Horizontal Motion</a>(:htmlend:)

* %list list-page% (:html:)<a href="/online/plot.php?d=pendulum&f=

to:

* %list list-page% (:html:)<a href="/online/plot.php?d=pendulum&f=pend3.x.xml">Vertical Motion</a>(:htmlend:)

* %list list-page% (:html:)<a href="/online/plot.php?d=pendulum&f=pend3.y.xml">Horizontal Motion</a>(:htmlend:)

* %list list-page% (:html:)<a href="/online/plot.php?d=pendulum&f=pend3.y.xml">Horizontal Motion</a>(:htmlend:)

Changed lines 37-38 from:

* %list list-page% (:html:)<a href="/online/plot.php?d=pendulum&f=~~SV(1)~~.xml">Vertical Motion</a>(:htmlend:)

* %list list-page% (:html:)<a href="/online/plot.php?d=pendulum&f=~~SV(2)~~.xml">Horizontal Motion</a>(:htmlend:)

* %list list-page% (:html:)<a href="/online/plot.php?d=pendulum&f=

to:

* %list list-page% (:html:)<a href="/online/plot.php?d=pendulum&f=pend.x.xml">Vertical Motion</a>(:htmlend:)

* %list list-page% (:html:)<a href="/online/plot.php?d=pendulum&f=pend.y.xml">Horizontal Motion</a>(:htmlend:)

* %list list-page% (:html:)<a href="/online/plot.php?d=pendulum&f=pend.y.xml">Horizontal Motion</a>(:htmlend:)

Changed line 40 from:

The mass and length of a pendulum can be determined by tracking the horizontal position of the pendulum (x). The following is a MATLAB script (pendulum.m) that runs the Index-3 DAE through a series of simulations. As additional data is collected, the model predictions are adjusted to match the observed measurements. The starting values for mass are 1 kg and a length of 1 ~~m~~.

to:

The mass and length of a pendulum can be determined by tracking the horizontal position of the pendulum (x). The following is a MATLAB script (pendulum.m) that runs the Index-3 DAE through a series of simulations. As additional data is collected, the model predictions are adjusted to match the observed measurements. The starting values for mass are 1 kg and a length of 1 meter.

Changed lines 42-43 from:

to:

* %list list-page% [[Attach:pendulum_mhe.zip | Download MATLAB Pendulum Example]]

Added lines 39-44:

The mass and length of a pendulum can be determined by tracking the horizontal position of the pendulum (x). The following is a MATLAB script (pendulum.m) that runs the Index-3 DAE through a series of simulations. As additional data is collected, the model predictions are adjusted to match the observed measurements. The starting values for mass are 1 kg and a length of 1 m.

Attach:download.jpg [[Attach:pendulum_mhe.zip | Download MATLAB Pendulum Example]]

The technique for aligning measured and model values is termed Moving Horizon Estimation. This is a technique for parameter estimation with differential and algebraic equation models. In this case there is no steady state data available. The mass and length can be determined by observing the time series of horizontal positions.

Changed lines 37-38 from:

* %list list-page% (:html:)<a href="~~http:~~//~~apmonitor~~.~~ath.cx/online/plot.~~php?d=pendulum&f=SV(1).xml">Vertical Motion</a>(:htmlend:)

* %list list-page% (:html:)<a href="~~http://apmonitor.ath.cx~~/online/plot.php?d=pendulum&f=SV(2).xml">Horizontal Motion</a>(:htmlend:)

* %list list-page% (:html:)<a href="

to:

* %list list-page% (:html:)<a href="/online/plot.php?d=pendulum&f=SV(1).xml">Vertical Motion</a>(:htmlend:)

* %list list-page% (:html:)<a href="/online/plot.php?d=pendulum&f=SV(2).xml">Horizontal Motion</a>(:htmlend:)

* %list list-page% (:html:)<a href="/online/plot.php?d=pendulum&f=SV(2).xml">Horizontal Motion</a>(:htmlend:)

Changed line 42 from:

(:html:)<font size=~~1~~><pre>

to:

(:html:)<font size=2><pre>

Changed lines 71-72 from:

(:htmlend:)

to:

(:htmlend:)

Changed line 7 from:

The following models are mathematically equivalent but are of different index order. The most natural form is an index-3 differential and algebraic (DAE) equation form, posed in terms of absolute position.

to:

The following models are mathematically equivalent but are of different index order. The most natural form is an index-3 differential and algebraic (DAE) equation form, posed in terms of absolute position. The index is the number of times the equations must be differentiated to achieve an ordinary differential equation (ODE) form.

Changed line 7 from:

The following models are mathematically equivalent but are of different order. The most natural form is an index-3 differential and algebraic (DAE) equation form, posed in terms of absolute position.

to:

The following models are mathematically equivalent but are of different index order. The most natural form is an index-3 differential and algebraic (DAE) equation form, posed in terms of absolute position.

Added lines 1-72:

!! Pendulum

The pendulum weight is located on the end of a massless cord suspended from a pivot, without friction. When given an initial push, it swings back and forth at a constant amplitude. Real pendulums are subject to friction and air drag, so the amplitude of the swing declines.

Attach:pendulum.png

The following models are mathematically equivalent but are of different order. The most natural form is an index-3 differential and algebraic (DAE) equation form, posed in terms of absolute position.

----

!!! Index-0 DAE (ODE) Model

* %list list-page% [[Attach:pend0.apm | pend0.apm]]

----

!!! Index-1 DAE Model

* %list list-page% [[Attach:pend1.apm | pend1.apm]]

----

!!! Index-2 DAE Model

* %list list-page% [[Attach:pend2.apm | pend2.apm]]

----

!!! Index-3 DAE Model

* %list list-page% [[Attach:pend3.apm | pend3.apm]]

----

!!!! Predictions

* %list list-page% (:html:)<a href="http://apmonitor.ath.cx/online/plot.php?d=pendulum&f=SV(1).xml">Vertical Motion</a>(:htmlend:)

* %list list-page% (:html:)<a href="http://apmonitor.ath.cx/online/plot.php?d=pendulum&f=SV(2).xml">Horizontal Motion</a>(:htmlend:)

----

(:html:)<font size=1><pre>

! APMonitor Modeling Language

! http://www.apmonitor.com

! Pendulum - Index 3 DAE

Model pend3

Parameters

m = 1

g = 9.81

s = 1

End Parameters

Variables

x = 0

y = -s

v = 1

w = 0

lam = m*(1+s*g)/2*s^2

End Variables

Equations

x^2 + y^2 = s^2

$x = v

$y = w

m*$v = -2*x*lam

m*$w = -m*g - 2*y*lam

End Equations

End Model

</pre></font>

(:htmlend:)

The pendulum weight is located on the end of a massless cord suspended from a pivot, without friction. When given an initial push, it swings back and forth at a constant amplitude. Real pendulums are subject to friction and air drag, so the amplitude of the swing declines.

Attach:pendulum.png

The following models are mathematically equivalent but are of different order. The most natural form is an index-3 differential and algebraic (DAE) equation form, posed in terms of absolute position.

----

!!! Index-0 DAE (ODE) Model

* %list list-page% [[Attach:pend0.apm | pend0.apm]]

----

!!! Index-1 DAE Model

* %list list-page% [[Attach:pend1.apm | pend1.apm]]

----

!!! Index-2 DAE Model

* %list list-page% [[Attach:pend2.apm | pend2.apm]]

----

!!! Index-3 DAE Model

* %list list-page% [[Attach:pend3.apm | pend3.apm]]

----

!!!! Predictions

* %list list-page% (:html:)<a href="http://apmonitor.ath.cx/online/plot.php?d=pendulum&f=SV(1).xml">Vertical Motion</a>(:htmlend:)

* %list list-page% (:html:)<a href="http://apmonitor.ath.cx/online/plot.php?d=pendulum&f=SV(2).xml">Horizontal Motion</a>(:htmlend:)

----

(:html:)<font size=1><pre>

! APMonitor Modeling Language

! http://www.apmonitor.com

! Pendulum - Index 3 DAE

Model pend3

Parameters

m = 1

g = 9.81

s = 1

End Parameters

Variables

x = 0

y = -s

v = 1

w = 0

lam = m*(1+s*g)/2*s^2

End Variables

Equations

x^2 + y^2 = s^2

$x = v

$y = w

m*$v = -2*x*lam

m*$w = -m*g - 2*y*lam

End Equations

End Model

</pre></font>

(:htmlend:)