地科探究html

地科探究 & 溫度分析網頁

溫度分析網頁 113/7/11 FINISHED
https://123456dr.github.io/temp_analyze/index.html


報告簡報

高畫質版PDF & 翻頁書 PDF不支援手機版查看


113/7/11完工紀錄

時隔以久的重啟動工:
學測數學讀到高一數據分析[迴歸直線,斜率,標準化,相關係數]
喚醒沉睡已久的熱情,
學以致用的概念,
使用c++ 格式化實驗數據資料

程式碼
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
#include <bits/stdc++.h>

int main() {
std::string input;
int count = 1;


while (std::getline(std::cin, input)) {


size_t pos = input.find("°C");
if (pos != std::string::npos) {
input.erase(pos, 3);

}


if (count <= 202) {
std::cout << "t=" << input << std::endl;
} else if (count >= 203 && count <= 404) {
std::cout << "h=" << input << std::endl;
} else{
std::cout << "s=" << input << std::endl;
}


count++;
}
for(int i=0;i<=202;i++)std::cout<<i<<" ";

return 0;
}

接著將資料手動輸入github倉庫的data.js達成靜態 page處理資料


親手設計迴歸直線

算術平均數

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
dataArray2.forEach(entry => {
const tempMatch2 = entry.match(/t=(-?\d+\.\d+)/);
const humidMatch2 = entry.match(/h=(-?\d+\.\d+)/);
const tMatch2 = entry.match(/s=(-?\d+\.\d+)/);

if (tempMatch2) {
const temp2 = parseFloat(tempMatch2[1]);
sumc += temp2;
data2.push({ temperature2: temp2 });
}

if (humidMatch2) {
const humid2 = parseFloat(humidMatch2[1]);
sumh += humid2;
data2.push({ humidity2: humid2 });
}
if (tMatch2) {
const t2 = parseFloat(tMatch2[1]);
suma += t2;
data2.push({ t2: t2 });
}
ii++;
});
sumc = sumc /101; //算術平均數
sumh = sumh / 101;
suma = suma /101;

方程式斜率

mc=mc(Sxy)/cu(Sxx)
可以發現Sxx相同,因為x座標皆為0~101(實驗秒數)

1
2
3
4
5
mc += (temp2 - sumc) * (ii - 51);

mc = mc / cu;
mh = mh / cu;
ma = ma / cu;

y平均(截距=>(0,sumc))

因為方程式 y-y平均=m(x-x平均)

1
2
3
let interceptC = sumc;
let interceptH = sumh;
let interceptA = suma;

迴歸直線斜率比較

三項氣體CO2 , H2O , AIR
針對斜率探討實驗結果 => 溫度上升速率: CO2 > AIR > H2O

實驗時,沒有統一各氣體的含量,可能導致實驗結果產生誤差。

1
2
3
4
5
6
7
將三氣體斜率以相同基準點對比
const fC= mc * (0 - 51) - interceptC;
const fH = mh * (0 - 51) - interceptH;
const fA = ma * (0 - 51) - interceptA;

圖表數據
temperatures2.map((_, i) => mc * (i - 51)- interceptC-fC ),

詳細程式碼

https://github.com/123456dr/temp_analyze/tree/7/12