Try   HackMD

SciDAVis 教學 2:作圖技巧及化直

作者:王一哲
日期:2019/12/4


作圖原則

  1. 假設自變數為
    x
    、應變數為
    y
    ,先畫出
    yx
    關係圖,如果數據點看起來分布在一條斜直線上,利用線性迴歸畫出最接近直線,計算斜率、截距及其不準量;如果數據點看起來是分布在一條曲線上則進行步驟2。
  2. 計算
    logx
    logy
    ,畫出
    logylogx
    關係圖,如果數據點看起來分布在一條斜直線上,利用線性迴歸畫出最接近直線,計算斜率、截距及其不準量,其中斜率可以代表
    x
    y
    取幾次方時兩者的關係為線性。假設
    x
    y
    數學關係為
    ym=kxn

    mlogy=logk+nlogx

    logy=nmlogx+logkm

    因此
    logylogx
    關係圖的最接近直線斜率為
    n/m
  3. 計算
    xn
    ym
    ,畫出
    ymxn
    關係圖,如果數據點看起來分布在一條斜直線上,利用線性迴歸畫出最接近直線,計算斜率、截距及其不準量。

自由落下時間與高度關係圖

假設小球原為靜止、離地面高度為

h、受到重力作用開始落下,只考慮重力的作用,重力加速度
g=9.8 m/s2
,小球在空中飛行時間為
t
、飛行時間不準量為
errt
,實驗數據如下

h(m),t(s),errt(s)
2,0.65,0.01
4,0.89,0.01
6,1.11,0.01
8,1.27,0.01
10,1.42,0.01
12,1.57,0.01
14,1.71,0.01
16,1.79,0.01
18,1.92,0.01
20,2.03,0.01

先畫出

th關係圖,發現數據點應該是分布在一條曲線上,無法進行線性擬合。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
t - h 關係圖

接下來計算

logt
logh
,先在資料表中插入兩個空的欄位

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
插入空的欄位

為了避免空白列中的東西影響到公式計算結果,最好能移除多餘的列。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
移除多餘的列

選取空的欄位後,按右方的第3個分頁Formula,接著輸入公式

log10(col("h"))

按下右上角的Apply套用公式,就可以計算欄位h當中所有數值的log值,再用同樣的方法計算欄位t當中所有數值的log值。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
輸入公式計算 log h

畫出

logtlogh關係圖,數據點看起來分布在一條斜直線上,線性擬合的結果為

=0.498075643829331±0.00468005995555611
=0.343035081717925±0.00469657969413444

R2=0.999294177388029

可以推測

th關係圖的數據點應該會分布在一條斜直線上。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
log t - log h 關係圖

計算

h,畫出
th
關係圖,線性擬合的結果為

=0.453008971741022±0.00332681637115833
=0.00343345881140915±0.0110338016495439

R2=0.999330244635544

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
t - 根號h 關係圖

自由落下物體飛行時間與高度的理論關係式為

h=12gt2  t=2hg

因此

th關係圖最接近直線斜率理論值
0.452
,百分誤差
0.22%


雙狹縫干涉條紋寬度與縫距關係圖

假設雙狹縫的縫距為

d、干涉條紋寬度為
y
、干涉條紋寬度不準量為
erry
,實驗數據如下

d(mm),y(mm),erry(mm)
0.10,6.2,0.1
0.20,3.0,0.1
0.30,2.2,0.1
0.40,1.5,0.1
0.50,1.3,0.1

先畫出

yd關係圖,發現數據點應該是分布在一條曲線上,無法進行線性擬合。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
y - d 關係圖

接下來計算

logy
logd
,畫出
logylogd
關係圖,數據點看起來分布在一條斜直線上,線性擬合的結果為

=0.976177616265074±0.0258646761462483
=0.187476038836598±0.0164029222944223

R2=0.997898332775322

可以推測

y1/d關係圖的數據點應該會分布在一條斜直線上。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
log y - log d 關係圖

計算

1/d,畫出
y1/d
關係圖,線性擬合的結果為

=0.613859556494192±0.0154140324718516
=0.036708025343189±0.083395787930577

R2=0.997991740579429

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
y - 1/d 關係圖

雙狹縫干涉條紋寬度與狹縫縫距的理論關係式為

y=λLd

其中

λ為波長、
L
為狹縫到屏幕的距離,這裡使用的實驗數據為
λ=633 nm=6.33×104 mm
L=1 m=1×103 mm
,因此
y1/d
關係圖最接近直線斜率理論值
=0.633
,百分誤差
3%


克卜勒第三行星運動定律

從網路上可以找到行星公轉軌道的資料,為了簡化數值,半長軸

a的單位為天文單位 (astronomical units, AU),公轉週期
T
的單位為地球年 (yr)。

行星 公轉週期T (yr) 半長軸 a (AU)
水星 0.241 0.387
金星 0.615 0.723
地球 1.000 1.000
火星 1.881 1.524
木星 11.862 5.203
土星 29.458 9.555
天王星 84.022 19.218
海王星 164.774 30.110

先畫出

aT關係圖,發現數據點應該是分布在一條曲線上,無法進行線性擬合。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
a - T 關係圖

接著再試著畫

logalogT 關係圖,圖中的數據點分布在一條直線上,線性擬合結果為

=0.666684934333627±0.000036181210991
=0.000015083250878±0.000045138730909

R2=0.999999963819

可以推測

a3T2關係圖的數據點應該會分布在一條斜直線上。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
log a - log T 關係圖

計算

a3
T2
,畫出
a3T2
關係圖,線性擬合結果為

=0.999968855984298±0.000005447763279
=0.102263315181479±0.0543289671454164

R2=0.99999999982192

由於單位採用 AU 及 yr,最接近直線的斜率會很接近1。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
a3 - T2 關係圖

由於上圖中資料點對應的數值較大,坐標軸旁邊標示的數字太多,看起來很雜亂,這時我們會將

a3
T2
的數值同除以某個倍數再作圖。假設倍數為1000,則單位改為
×103 AU
×103 yr
,圖片看起來會比較精簡。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
a3 - T2 關係圖(單位改為1000倍)

折射定律

當光從折射率為

n1的介質射向折射率為
n2
的介質時,若
n2>n1
,折射光會偏向法線,也就是入射角
θ1
小於折射角
θ2
,實驗數據如下表。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
折射定律示意圖

入射角
θ1()
折射角
θ2()
10 8
20 15
30 22
40 29
50 35
60 40
70 45
80 48

先畫出

θ1θ2關係圖,發現數據點應該是分布在一條曲線上,無法進行線性擬合。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
θ2 - θ1 關係圖

接著再試著畫

logθ2logθ1 關係圖,圖中的數據點依然不是分布在一條直線上,可以推測兩者的關係應該不是加上次方這麼單純。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
log θ2 - log θ1 關係圖

實際上折射定律為

n1sinθ1=n2sinθ2  sinθ2sinθ1=n1n2

計算

sinθ2
sinθ1
,再畫出
sinθ2sinθ1
關係圖,線性擬合結果為

=0.742805801759476±0.00561557104745917
=0.00628404135667623±0.00397080836789323

R2=0.999657200936133

由於這是光由空氣進到水中的實驗數據,

n1=1
n2=4/3
,最接近直線的斜率會很接近0.75,百分誤差
0.1%

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
sin θ2 - sin θ1 關係圖


tags:SciDAVisPhysics校訂必修