回上方

第9堂課

虎克定律

定義:在彈性限度內,彈簧伸長量與其所受外力成正比。

公式:外力=彈力係數 X 伸長量

F= - k*△x = m * a

a = -(k/m)*△x

_images/B1102.png
 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
# -*- coding: utf8 -*-
# 匯入視覺化套件
from vpython import *

# 1. 參數設定
# 木塊質量 0.5 kg
m = 0.5
# 彈簧的彈性係數 10 N/m
k = 10.0
# 時間間隔
dt = 0.001

# 2. 畫面設定
# 畫布
scene = canvas(width=1000, height=1000, background=vector(0.5,0.6,0.5))
# 地板
floor = box(length=3, height=0.01, width=1, texture=textures.stucco)
# 牆面
wall = box(length=0.01, height=0.5, width=1, texture=textures.stucco)
# 木塊
square = box(length=0.2, height=0.2, width=0.2, texture=textures.wood)
# 彈簧
spring = helix(radius=0.06, coils=15, thickness = 0.03)

# 設定地板位置
floor.pos = vector(0, 0, 0)
# 設定牆面位置
wall.pos = vector(-floor.length/2, wall.height/2, 0)
# 設定木塊位置
square.pos = vector(0, square.height/2, 0)
# 設定木塊初速
square.v = vector(2,0,0)
# 設定彈簧位置
spring.pos = vector(-floor.length/2, square.height/2,0)
# 設定彈簧軸線(長度)
spring.axis = square.pos-spring.pos
# 取得彈簧原長
spring.L = spring.length

# 3. 運動部分
while True:
    rate(1000)
    #彈簧的加速度 a= ( k / m ) * 彈簧的伸長量 * 彈簧的反方向
    square.a = -(k/m)*(spring.length-spring.L) * spring.axis.norm()
    square.v = square.v + square.a*dt
    square.pos = square.pos + square.v * dt
    #求出彈簧的長度
    spring.axis = square.pos-spring.pos

作業

請畫出時間與木塊x座標位置關係圖

_images/B10012.png

作業

請畫出z軸的時間位置圖,如下圖。

_images/B1103.png

本單元課程自2018.7.5日起已被瀏覽 84