FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
smallbasic.github.io/samples/node/1034.bas at master · smallbasic/smallbasic.github.io · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
smallbasic
/
smallbasic.github.io
Public
Notifications
You must be signed in to change notification settings
Fork
4
Star
4
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
smallbasic.github.io
/
samples
/
node
/
1034.bas
Copy path
More file actions
More file actions
Latest commit
History
History
History
62 lines (54 loc) · 2.27 KB
Breadcrumbs
smallbasic.github.io
/
samples
/
node
/
1034.bas
Copy path
File metadata and controls
62 lines (54 loc) · 2.27 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
'
spring and mass animation
'
response of masses and springs to displacement by a sinusoidal driver
WINDOW
-500
,
-1200
,
500
,
100
'
set up differential equations of motion for top and bottom masses
func
osct
(
mt
,
kt
,
kb
,
tn
,
bn
,
xt
,
xb
,
fr
,
zt
) = -
kt
* (
xt
-
tn
+
fr
) /
mt
+
kb
* (
xb
-
xt
-
bn
) /
mt
- .
1
* zt
func
oscb
(
mb
,
kb
,
nb
,
xt
,
xb
,
zb
) = -
kb
* (
xb
-
xt
-
bn
) /
mb
- .
1
* zb
'
input initial positions and velocities
PRINT
"
damped driven masses program
"
PRINT
"
vertical range is (top) 0 to (bottom) 120
"
INPUT
"
top mass initial speed, m/s (0)
"
; zt
INPUT
"
top mass initial position, m (40)
"
; xt
INPUT
"
top spring natural length, m (40)
"
; tn
INPUT
"
top mass, kg (40)
"
; mt
INPUT
"
top spring constant, N/m (40)
"
; kt
INPUT
"
bottom mass initial speed, m/s (0)
"
; zb
INPUT
"
bottom mass initial position, m (80)
"
; xb
INPUT
"
bottom spring natural length, m (40)
"
; bn
INPUT
"
bottom mass, kg (30)
"
; mb
INPUT
"
bottom spring constant, N/m (30)
"
; kb
INPUT
"
final t, seconds (200)
"
; tf
INPUT
"
frequency sweep rate, Hz/sec (.01)
"
; hz
n
=
20
* tf:
h
=
tf
/
n
:
fact
=
hz
*
tf
/
n
CLS
'
evaluate the differential equations
FOR
q
=
1
TO
n
fr
=
5
*
SIN
(
fact
* q *
t
)
kt1
=
h
* zt:
lt1
=
h
*
osct
(
mt
,
kt
,
kb
,
tn
,
bn
,
xt
,
xb
,
fr
,
zt
)
kb1
=
h
* zb:
lb1
=
h
*
oscb
(
mb
,
kb
,
bn
,
xt
,
xb
,
zb
)
kt2
=
h
* (
zt
+ .
5
*
lt1
)
kb2
=
h
* (
zb
+ .
5
*
lb1
)
lt2
=
h
*
osct
(
mt
,
kt
,
kb
,
tn
,
bn
,
xt
+ .
5
* kt1,
xb
+ .
5
* kb1,
fr
,
zt
)
lb2
=
h
*
oscb
(
mb
,
kb
,
bn
,
xt
+ .
5
* kt1,
xb
+ .
5
* kb1,
zb
)
kt3
=
h
* (
zt
+ .
5
*
lt2
)
kb3
=
h
* (
zb
+ .
5
*
lb2
)
lt3
=
h
*
osct
(
mt
,
kt
,
kb
,
tn
,
bn
,
xt
+ .
5
* kt2,
xb
+ .
5
* kb2,
fr
,
zt
)
lb3
=
h
*
oscb
(
mb
,
kb
,
bn
,
xt
+ .
5
* kt2,
xb
+ .
5
* kb2,
zb
)
kt4
=
h
* (
zt
+
lt3
)
kb4
=
h
* (
zb
+
lb3
)
xt
=
xt
+ (
kt1
+
2
*
kt2
+
2
*
kt3
+
kt4
) /
6
xb
=
xb
+ (
kb1
+
2
*
kb2
+
2
*
kb3
+
kb4
) /
6
zt
=
kt4
/
h
:
zb
=
kb4
/
h
:
t
=
t
+
h
xtp
= -
xt
:
xbp
= -
xb
'
white out old graphic
for
dd
=
0
to
16000
:
next
dd
LINE
-50
,
10
*frold,
50
,
10
* frold,
15
CIRCLE
0
,
10
*xtpold,
10
,
1
,
COLOR
15
FILLED: LINE
0
,
10
*frold,
0
,
10
* xtpold,
15
LINE
0
,
10
*xtpold,
0
,
10
*xbpold,
15
: CIRCLE
0
,
10
*xbpold,
10
,
1
,
COLOR
15
FILLED
'
draw new graphic
LINE
-50
,
10
*fr,
50
,
10
* fr
CIRCLE
0
,
10
*xtp,
10
,
1
,
COLOR
4
FILLED: LINE
0
,
10
*fr,
0
,
10
* xtp,
4
LINE
0
,
10
*xtp,
0
,
10
*xbp,
3
: CIRCLE
0
,
10
*xbp,
10
,
1
,
COLOR
3
FILLED
for
dd
=
0
to
16000
:
next
dd
frold
=
fr
:
xtpold
=
xtp
:
xbpold
=
xbp
NEXT
q
Back
|
FazBrowse Home
|
New Git URL