mirror of
https://gitlab.rlp.net/pgp/pgp1-python-einfuehrung
synced 2024-11-16 13:48:11 +00:00
Corrected error in the chi-square calculation.
This commit is contained in:
parent
c682917c23
commit
a4eb95baf4
1 changed files with 17 additions and 18 deletions
|
@ -2632,7 +2632,6 @@
|
||||||
" # wir in der Regel absolute und keine relativen \n",
|
" # wir in der Regel absolute und keine relativen \n",
|
||||||
" # Unsicherheiten messen.\n",
|
" # Unsicherheiten messen.\n",
|
||||||
" )\n",
|
" )\n",
|
||||||
"\n",
|
|
||||||
"plt.errorbar(strom, \n",
|
"plt.errorbar(strom, \n",
|
||||||
" spannung,\n",
|
" spannung,\n",
|
||||||
" xerr=strom_error,\n",
|
" xerr=strom_error,\n",
|
||||||
|
@ -2682,11 +2681,11 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 67,
|
"execution_count": 84,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2019-10-31T12:32:15.057094Z",
|
"end_time": "2019-10-31T12:54:51.185843Z",
|
||||||
"start_time": "2019-10-31T12:32:15.041472Z"
|
"start_time": "2019-10-31T12:54:51.152000Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
|
@ -2694,14 +2693,14 @@
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Das chi-qudrat ist 506\n"
|
"Das chi-qudrat ist 1.26\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"chi_2 = [ (u - Spannung(I, para2[0])/du)**2 for I,u,du in zip(strom, spannung, spannung_error)]\n",
|
"chi_2 = [ (u - Spannung(i, para2[0]))**2/du**2 for i,u,du in zip(strom, spannung, spannung_error)]\n",
|
||||||
"chi_2 = sum(chi_2)\n",
|
"chi_2 = sum(chi_2)\n",
|
||||||
"print(f'Das chi-qudrat ist {chi_2:.0f}')"
|
"print(f'Das chi-qudrat ist {chi_2:.2f}')"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -2710,18 +2709,18 @@
|
||||||
"source": [
|
"source": [
|
||||||
"Wie vergleicht sich dieses $\\chi^2$ nun mit einer Funktion welche unsere Daten schlechter beschreibt. Zum Beispiel sofern wir die Spannung über die Funktion \n",
|
"Wie vergleicht sich dieses $\\chi^2$ nun mit einer Funktion welche unsere Daten schlechter beschreibt. Zum Beispiel sofern wir die Spannung über die Funktion \n",
|
||||||
"\n",
|
"\n",
|
||||||
"$$ U(R,I) = R \\cdot I + C $$\n",
|
"$$ U(R,I) = R \\cdot I^2 $$\n",
|
||||||
"\n",
|
"\n",
|
||||||
"beschreiben würden, also zusätzlich einem konstantem Offset."
|
"beschreiben würden."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 68,
|
"execution_count": 88,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"ExecuteTime": {
|
"ExecuteTime": {
|
||||||
"end_time": "2019-10-31T12:32:15.088340Z",
|
"end_time": "2019-10-31T12:55:52.889042Z",
|
||||||
"start_time": "2019-10-31T12:32:15.057094Z"
|
"start_time": "2019-10-31T12:55:52.873421Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
|
@ -2729,14 +2728,14 @@
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Chi-qudrat nach URI: 506\n",
|
"Chi-qudrat nach URI: 1.26\n",
|
||||||
"Chi-qudrat nach URIC: 506\n"
|
"Chi-qudrat nach URI-Parabel: 60.68\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"def Spannung2(I, R, C):\n",
|
"def Spannung2(I, R):\n",
|
||||||
" return R * I + C \n",
|
" return R * I**2\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -2747,9 +2746,9 @@
|
||||||
" absolute_sigma=True \n",
|
" absolute_sigma=True \n",
|
||||||
" )\n",
|
" )\n",
|
||||||
"\n",
|
"\n",
|
||||||
"chi_2_new = [ (u - Spannung2(I, *para3)/du)**2 for I,u,du in zip(strom, spannung, spannung_error)]\n",
|
"chi_2_new = [ (u - Spannung2(I, *para3))**2/du**2 for I,u,du in zip(strom, spannung, spannung_error)]\n",
|
||||||
"chi_2_new = sum(chi_2_new)\n",
|
"chi_2_new = sum(chi_2_new)\n",
|
||||||
"print(f'Chi-qudrat nach URI: {chi_2:.0f}\\nChi-qudrat nach URIC: {chi_2_new:.0f}')"
|
"print(f'Chi-qudrat nach URI: {chi_2:.2f}\\nChi-qudrat nach URI-Parabel: {chi_2_new:.2f}')"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue