File: viscous.ode

package info (click to toggle)
plotutils 2.4.1-11
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 11,676 kB
  • ctags: 6,967
  • sloc: ansic: 76,305; sh: 15,172; cpp: 12,403; yacc: 2,604; makefile: 888; lex: 144
file content (26 lines) | stat: -rw-r--r-- 689 bytes parent folder | download | duplicates (14)
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
# This example simulates a bead sliding on a smooth circular wire.  The
# output displays the height of the bead as a function of time.  There is
# viscous damping, so the bead should settle toward the equilibrium point
# (i.e. ordinate = 0).

# You may run this example by doing:
#
#    ode < viscous.ode | graph -T X -C
#
# or alternatively, to get a real-time plot,
#
#    ode < viscous.ode | graph -T X -C -x 0 20 -y 0 2.5

a = 1  # radius of circular wire
g = 10 # acceleration due to gravity
w = 10 # angular velocity of circular wire
b = 1  # damping coefficient

the' = vthe
vthe' = (w^2)*sin(the)*cos(the) - (g/a)*sin(the) - b * vthe
the = 0.1
vthe = 0

print t, the 

step 0, 20