FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
smallbasic.github.io/samples/node/1035.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
/
1035.bas
Copy path
More file actions
More file actions
Latest commit
History
History
History
57 lines (51 loc) · 2.3 KB
Breadcrumbs
smallbasic.github.io
/
samples
/
node
/
1035.bas
Copy path
File metadata and controls
57 lines (51 loc) · 2.3 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
'
Two masses suspended by two springs in tandem are subject to a driving motion.
'
The driving motion is sinusoidal, with an increasing frequency characterized by an increasing sweep rate.
'
The system is described by mass and by spring length and stiffness.
'
The output graph shows the driver motion on top, and the response of the two masses below.
'
Notice the two resonance intervals where mass displacement is greatest.
'
From the left, the masses are initially in phase, and later resonate out of phase.
WINDOW
0
,
-1200
,
1000
,
100
'
write function for the differential equations of motion.
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 conditions
PRINT
"
driven coupled masses with dampening 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 time (300)
"
; tf:
n
=
60
* tf:
h
=
tf
/
n
INPUT
"
frequency sweeprate, Hz/sec (.004)
"
; hz
'
time step loops to find the system response
t
=
0
:
fact
=
hz
*
tf
/
n
:
CLS
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
:
tme
=
100
*
q
/
n
'
plot the graph
PSET
10
*tme,
10
*fr
PSET
10
*tme,
10
*xtp,
9
PSET
10
*tme,
10
*xbp,
3
NEXT
q
end
Back
|
FazBrowse Home
|
New Git URL