Skip to content
Permalink
be87778adb
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
1833 lines (1833 sloc) 131 KB
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"setdefaults"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%plot --format svg"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"# General Linear Regression"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In general, you may want to fit other polynomials besides degree-1 (straight-lines)\n",
"\n",
"$y=a_{0}+a_{1}x+a_{2}x^{2}+\\cdots+a_{m}x^{m}+e$\n",
"\n",
"Now, the solution for $a_{0},~a_{1},...a_{m}$ is the minimization of m+1-dependent linear equations. \n",
"\n",
"Consider the following data:\n",
"\n",
"| x | y |\n",
"|---|---|\n",
"| 0.00 | 21.50 |\n",
"| 2.00 | 20.84 |\n",
"| 4.00 | 23.19 |\n",
"| 6.00 | 22.69 |\n",
"| 8.00 | 30.27 |\n",
"| 10.00 | 40.11 |\n",
"| 12.00 | 43.31 |\n",
"| 14.00 | 54.79 |\n",
"| 16.00 | 70.88 |\n",
"| 18.00 | 89.48 |\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"420px\" viewBox=\"0 0 560 420\" width=\"560px\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"\n",
"<title>Gnuplot</title>\n",
"<desc>Produced by GNUPLOT 5.0 patchlevel 3 </desc>\n",
"\n",
"<g id=\"gnuplot_canvas\">\n",
"\n",
"<rect fill=\"none\" height=\"420\" width=\"560\" x=\"0\" y=\"0\"/>\n",
"<defs>\n",
"\n",
"\t<circle id=\"gpDot\" r=\"0.5\" stroke-width=\"0.5\"/>\n",
"\t<path d=\"M-1,0 h2 M0,-1 v2\" id=\"gpPt0\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,-1 L1,1 M1,-1 L-1,1\" id=\"gpPt1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1\" id=\"gpPt2\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<rect height=\"2\" id=\"gpPt3\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<rect fill=\"currentColor\" height=\"2\" id=\"gpPt4\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<circle cx=\"0\" cy=\"0\" id=\"gpPt5\" r=\"1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt6\" stroke=\"none\" xlink:href=\"#gpPt5\"/>\n",
"\t<path d=\"M0,-1.33 L-1.33,0.67 L1.33,0.67 z\" id=\"gpPt7\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt8\" stroke=\"none\" xlink:href=\"#gpPt7\"/>\n",
"\t<use id=\"gpPt9\" stroke=\"currentColor\" transform=\"rotate(180)\" xlink:href=\"#gpPt7\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt10\" stroke=\"none\" xlink:href=\"#gpPt9\"/>\n",
"\t<use id=\"gpPt11\" stroke=\"currentColor\" transform=\"rotate(45)\" xlink:href=\"#gpPt3\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt12\" stroke=\"none\" xlink:href=\"#gpPt11\"/>\n",
"\t<path d=\"M0,1.330 L1.265,0.411 L0.782,-1.067 L-0.782,-1.076 L-1.265,0.411 z\" id=\"gpPt13\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt14\" stroke=\"none\" xlink:href=\"#gpPt13\"/>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"textbox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"white\" flood-opacity=\"1\" result=\"bgnd\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"bgnd\" operator=\"atop\"/>\n",
"\t</filter>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"greybox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"lightgrey\" flood-opacity=\"1\" result=\"grey\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"grey\" operator=\"atop\"/>\n",
"\t</filter>\n",
"</defs>\n",
"<g color=\"white\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"\t<g shape-rendering=\"crispEdges\" stroke=\"none\">\n",
"\t\t<polygon fill=\"rgb(255, 255, 255)\" points=\"37.3,384.0 534.9,384.0 534.9,16.8 37.3,16.8 \"/>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"rgb(255, 255, 255)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,384.0 L49.8,384.0 M535.0,384.0 L522.5,384.0 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,390.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">20</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,331.5 L49.8,331.5 M535.0,331.5 L522.5,331.5 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,337.5)\">\n",
"\t\t<text><tspan font-family=\"{}\">30</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,279.1 L49.8,279.1 M535.0,279.1 L522.5,279.1 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,285.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">40</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,226.6 L49.8,226.6 M535.0,226.6 L522.5,226.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,232.6)\">\n",
"\t\t<text><tspan font-family=\"{}\">50</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,174.1 L49.8,174.1 M535.0,174.1 L522.5,174.1 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,180.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">60</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,121.6 L49.8,121.6 M535.0,121.6 L522.5,121.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,127.6)\">\n",
"\t\t<text><tspan font-family=\"{}\">70</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,69.2 L49.8,69.2 M535.0,69.2 L522.5,69.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,75.2)\">\n",
"\t\t<text><tspan font-family=\"{}\">80</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,16.7 L49.8,16.7 M535.0,16.7 L522.5,16.7 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,22.7)\">\n",
"\t\t<text><tspan font-family=\"{}\">90</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,384.0 L37.3,371.5 M37.3,16.7 L37.3,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(37.3,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M161.7,384.0 L161.7,371.5 M161.7,16.7 L161.7,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(161.7,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M286.2,384.0 L286.2,371.5 M286.2,16.7 L286.2,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(286.2,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">10</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M410.6,384.0 L410.6,371.5 M410.6,16.7 L410.6,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(410.6,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">15</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M535.0,384.0 L535.0,371.5 M535.0,16.7 L535.0,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(535.0,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">20</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,16.7 L37.3,384.0 L535.0,384.0 L535.0,16.7 L37.3,16.7 Z \" stroke=\"black\"/></g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"\t<g id=\"gnuplot_plot_1a\"><title>gnuplot_plot_1a</title>\n",
"<g color=\"white\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<g onmousemove=\"gnuplot_svg.showHypertext(evt,'')\" onmouseout=\"gnuplot_svg.hideHypertext()\"><title> </title>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(37.3,376.1) scale(12.00)\" xlink:href=\"#gpPt5\"/></g>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(87.1,379.6) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(136.8,367.3) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(186.6,369.9) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(236.4,330.1) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(286.2,278.5) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(335.9,261.7) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(385.7,201.5) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(435.5,117.0) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(485.2,19.4) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"</g>\n",
"\t</g>\n",
"<g color=\"white\" fill=\"none\" stroke=\"rgb( 0, 0, 255)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"load xy_data.csv\n",
"x=xy_data(:,1);\n",
"y=xy_data(:,2);\n",
"plot(x,y,'o')"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"xy_data =\n",
"\n",
" 0.00000 21.50000\n",
" 2.00000 20.84000\n",
" 4.00000 23.19000\n",
" 6.00000 22.69000\n",
" 8.00000 30.27000\n",
" 10.00000 40.11000\n",
" 12.00000 43.31000\n",
" 14.00000 54.79000\n",
" 16.00000 70.88000\n",
" 18.00000 89.48000\n",
"\n"
]
}
],
"source": [
"xy_data"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The model can be rewritten as \n",
"\n",
"$y=\\left[Z\\right]a+e$\n",
"\n",
"where $a=\\left[\\begin{array}{c}\n",
" a_{0}\\\\\n",
" a_{1}\\\\\n",
" a_{2}\\end{array}\\right]$\n",
" \n",
"$[Z]=\\left[\\begin{array} \n",
"1 & x_{1} & x_{1}^{2} \\\\\n",
"1 & x_{2} & x_{2}^{2} \\\\\n",
"1 & x_{3} & x_{3}^{2} \\\\\n",
"1 & x_{4} & x_{4}^{2} \\\\\n",
"1 & x_{5} & x_{5}^{2} \\\\\n",
"1 & x_{6} & x_{6}^{2} \\\\\n",
"1 & x_{7} & x_{7}^{2} \\\\\n",
"1 & x_{8} & x_{8}^{2} \\\\\n",
"1 & x_{9} & x_{9}^{2} \\\\\n",
"1 & x_{10} & x_{10}^{2} \\end{array}\\right]$\n",
"\n",
"The sum of squares residuals for this model is\n",
"\n",
"$S_{r}=\\sum_{i=1}^{n}\\left(y_{i}-\\sum_{j=0}^{m}a_{j}z_{ji}\\right)^2$\n",
"\n",
"Minimizing this function results in\n",
"\n",
"$y=[Z]a$\n",
"\n",
"->**A standard Linear Algebra Problem**\n",
"\n",
"*the vector a is unknown, and Z is calculated based upon the assumed function*\n"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Z =\n",
"\n",
" 1 0 0\n",
" 1 2 4\n",
" 1 4 16\n",
" 1 6 36\n",
" 1 8 64\n",
" 1 10 100\n",
" 1 12 144\n",
" 1 14 196\n",
" 1 16 256\n",
" 1 18 324\n",
"\n",
"a =\n",
"\n",
" 22.46691\n",
" -1.36269\n",
" 0.27634\n",
"\n"
]
}
],
"source": [
"Z=[x.^0,x,x.^2]\n",
"\n",
"a=Z\\y"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"420px\" viewBox=\"0 0 560 420\" width=\"560px\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"\n",
"<title>Gnuplot</title>\n",
"<desc>Produced by GNUPLOT 5.0 patchlevel 3 </desc>\n",
"\n",
"<g id=\"gnuplot_canvas\">\n",
"\n",
"<rect fill=\"none\" height=\"420\" width=\"560\" x=\"0\" y=\"0\"/>\n",
"<defs>\n",
"\n",
"\t<circle id=\"gpDot\" r=\"0.5\" stroke-width=\"0.5\"/>\n",
"\t<path d=\"M-1,0 h2 M0,-1 v2\" id=\"gpPt0\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,-1 L1,1 M1,-1 L-1,1\" id=\"gpPt1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1\" id=\"gpPt2\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<rect height=\"2\" id=\"gpPt3\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<rect fill=\"currentColor\" height=\"2\" id=\"gpPt4\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<circle cx=\"0\" cy=\"0\" id=\"gpPt5\" r=\"1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt6\" stroke=\"none\" xlink:href=\"#gpPt5\"/>\n",
"\t<path d=\"M0,-1.33 L-1.33,0.67 L1.33,0.67 z\" id=\"gpPt7\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt8\" stroke=\"none\" xlink:href=\"#gpPt7\"/>\n",
"\t<use id=\"gpPt9\" stroke=\"currentColor\" transform=\"rotate(180)\" xlink:href=\"#gpPt7\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt10\" stroke=\"none\" xlink:href=\"#gpPt9\"/>\n",
"\t<use id=\"gpPt11\" stroke=\"currentColor\" transform=\"rotate(45)\" xlink:href=\"#gpPt3\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt12\" stroke=\"none\" xlink:href=\"#gpPt11\"/>\n",
"\t<path d=\"M0,1.330 L1.265,0.411 L0.782,-1.067 L-0.782,-1.076 L-1.265,0.411 z\" id=\"gpPt13\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt14\" stroke=\"none\" xlink:href=\"#gpPt13\"/>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"textbox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"white\" flood-opacity=\"1\" result=\"bgnd\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"bgnd\" operator=\"atop\"/>\n",
"\t</filter>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"greybox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"lightgrey\" flood-opacity=\"1\" result=\"grey\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"grey\" operator=\"atop\"/>\n",
"\t</filter>\n",
"</defs>\n",
"<g color=\"white\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"\t<g shape-rendering=\"crispEdges\" stroke=\"none\">\n",
"\t\t<polygon fill=\"rgb(255, 255, 255)\" points=\"37.3,384.0 534.9,384.0 534.9,16.8 37.3,16.8 \"/>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"rgb(255, 255, 255)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,384.0 L49.8,384.0 M535.0,384.0 L522.5,384.0 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,390.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">20</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,331.5 L49.8,331.5 M535.0,331.5 L522.5,331.5 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,337.5)\">\n",
"\t\t<text><tspan font-family=\"{}\">30</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,279.1 L49.8,279.1 M535.0,279.1 L522.5,279.1 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,285.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">40</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,226.6 L49.8,226.6 M535.0,226.6 L522.5,226.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,232.6)\">\n",
"\t\t<text><tspan font-family=\"{}\">50</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,174.1 L49.8,174.1 M535.0,174.1 L522.5,174.1 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,180.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">60</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,121.6 L49.8,121.6 M535.0,121.6 L522.5,121.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,127.6)\">\n",
"\t\t<text><tspan font-family=\"{}\">70</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,69.2 L49.8,69.2 M535.0,69.2 L522.5,69.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,75.2)\">\n",
"\t\t<text><tspan font-family=\"{}\">80</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,16.7 L49.8,16.7 M535.0,16.7 L522.5,16.7 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,22.7)\">\n",
"\t\t<text><tspan font-family=\"{}\">90</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,384.0 L37.3,371.5 M37.3,16.7 L37.3,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(37.3,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M161.7,384.0 L161.7,371.5 M161.7,16.7 L161.7,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(161.7,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M286.2,384.0 L286.2,371.5 M286.2,16.7 L286.2,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(286.2,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">10</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M410.6,384.0 L410.6,371.5 M410.6,16.7 L410.6,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(410.6,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">15</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M535.0,384.0 L535.0,371.5 M535.0,16.7 L535.0,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(535.0,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">20</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,16.7 L37.3,384.0 L535.0,384.0 L535.0,16.7 L37.3,16.7 Z \" stroke=\"black\"/></g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"\t<g id=\"gnuplot_plot_1a\"><title>gnuplot_plot_1a</title>\n",
"<g color=\"white\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<g onmousemove=\"gnuplot_svg.showHypertext(evt,'')\" onmouseout=\"gnuplot_svg.hideHypertext()\"><title> </title>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(37.3,376.1) scale(12.00)\" xlink:href=\"#gpPt5\"/></g>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(87.1,379.6) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(136.8,367.3) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(186.6,369.9) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(236.4,330.1) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(286.2,278.5) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(335.9,261.7) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(385.7,201.5) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(435.5,117.0) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(485.2,19.4) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"</g>\n",
"\t</g>\n",
"\t<g id=\"gnuplot_plot_2a\"><title>gnuplot_plot_2a</title>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<path d=\"M37.3,371.1 L41.8,372.3 L46.3,373.5 L50.9,374.5 L55.4,375.5 L59.9,376.4 L64.4,377.1 L69.0,377.8 L73.5,378.4 L78.0,378.9 L82.5,379.3 L87.1,379.6 L91.6,379.8 L96.1,379.9 L100.6,379.9 L105.2,379.8 L109.7,379.6 L114.2,379.3 L118.7,378.9 L123.3,378.5 L127.8,377.9 L132.3,377.2 L136.8,376.5 L141.4,375.6 L145.9,374.6 L150.4,373.6 L154.9,372.5 L159.5,371.2 L164.0,369.9 L168.5,368.4 L173.0,366.9 L177.6,365.3 L182.1,363.6 L186.6,361.8 L191.1,359.8 L195.7,357.8 L200.2,355.7 L204.7,353.5 L209.2,351.2 L213.8,348.8 L218.3,346.4 L222.8,343.8 L227.3,341.1 L231.9,338.3 L236.4,335.5 L240.9,332.5 L245.4,329.4 L250.0,326.3 L254.5,323.0 L259.0,319.7 L263.5,316.2 L268.1,312.7 L272.6,309.0 L277.1,305.3 L281.6,301.5 L286.2,297.6 L290.7,293.5 L295.2,289.4 L299.7,285.2 L304.2,280.9 L308.8,276.5 L313.3,272.0 L317.8,267.4 L322.3,262.7 L326.9,257.9 L331.4,253.0 L335.9,248.1 L340.4,243.0 L345.0,237.8 L349.5,232.5 L354.0,227.2 L358.5,221.7 L363.1,216.2 L367.6,210.5 L372.1,204.8 L376.6,198.9 L381.2,193.0 L385.7,187.0 L390.2,180.8 L394.7,174.6 L399.3,168.3 L403.8,161.9 L408.3,155.3 L412.8,148.7 L417.4,142.0 L421.9,135.2 L426.4,128.3 L430.9,121.3 L435.5,114.3 L440.0,107.1 L444.5,99.8 L449.0,92.4 L453.6,84.9 L458.1,77.4 L462.6,69.7 L467.1,62.0 L471.7,54.1 L476.2,46.1 L480.7,38.1 L485.2,30.0 \" stroke=\"rgb( 0, 128, 0)\"/></g>\n",
"\t</g>\n",
"<g color=\"white\" fill=\"none\" stroke=\"rgb( 0, 128, 0)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"x_fcn=linspace(min(x),max(x));\n",
"plot(x,y,'o',x_fcn,a(1)+a(2)*x_fcn+a(3)*x_fcn.^2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### General Coefficient of Determination\n",
"\n",
"$r^{2}=\\frac{S_{t}-S_{r}}{S_{t}}=1-\\frac{S_{r}}{S_t}$"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"St = 27.923\n",
"Sr = 2.6366\n"
]
}
],
"source": [
"St=std(y)\n",
"Sr=std(y-a(1)-a(2)*x-a(3)*x.^2)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"the coefficient of determination for this fit is 0.880485\n",
"the correlation coefficient this fit is 0.938342\n"
]
}
],
"source": [
"r2=1-Sr/St;\n",
"r=sqrt(r2);\n",
"\n",
"fprintf('the coefficient of determination for this fit is %f',r2)\n",
"fprintf('the correlation coefficient this fit is %f',r)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Compare this to a straight line fit"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"St = 27.923\n",
"Sr = 9.2520\n",
"the coefficient of determination for this fit is 0.668655\n",
"the correlation coefficient this fit is 0.817713\n"
]
},
{
"data": {
"image/svg+xml": [
"<svg height=\"420px\" viewBox=\"0 0 560 420\" width=\"560px\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"\n",
"<title>Gnuplot</title>\n",
"<desc>Produced by GNUPLOT 5.0 patchlevel 3 </desc>\n",
"\n",
"<g id=\"gnuplot_canvas\">\n",
"\n",
"<rect fill=\"none\" height=\"420\" width=\"560\" x=\"0\" y=\"0\"/>\n",
"<defs>\n",
"\n",
"\t<circle id=\"gpDot\" r=\"0.5\" stroke-width=\"0.5\"/>\n",
"\t<path d=\"M-1,0 h2 M0,-1 v2\" id=\"gpPt0\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,-1 L1,1 M1,-1 L-1,1\" id=\"gpPt1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1\" id=\"gpPt2\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<rect height=\"2\" id=\"gpPt3\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<rect fill=\"currentColor\" height=\"2\" id=\"gpPt4\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<circle cx=\"0\" cy=\"0\" id=\"gpPt5\" r=\"1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt6\" stroke=\"none\" xlink:href=\"#gpPt5\"/>\n",
"\t<path d=\"M0,-1.33 L-1.33,0.67 L1.33,0.67 z\" id=\"gpPt7\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt8\" stroke=\"none\" xlink:href=\"#gpPt7\"/>\n",
"\t<use id=\"gpPt9\" stroke=\"currentColor\" transform=\"rotate(180)\" xlink:href=\"#gpPt7\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt10\" stroke=\"none\" xlink:href=\"#gpPt9\"/>\n",
"\t<use id=\"gpPt11\" stroke=\"currentColor\" transform=\"rotate(45)\" xlink:href=\"#gpPt3\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt12\" stroke=\"none\" xlink:href=\"#gpPt11\"/>\n",
"\t<path d=\"M0,1.330 L1.265,0.411 L0.782,-1.067 L-0.782,-1.076 L-1.265,0.411 z\" id=\"gpPt13\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt14\" stroke=\"none\" xlink:href=\"#gpPt13\"/>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"textbox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"white\" flood-opacity=\"1\" result=\"bgnd\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"bgnd\" operator=\"atop\"/>\n",
"\t</filter>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"greybox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"lightgrey\" flood-opacity=\"1\" result=\"grey\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"grey\" operator=\"atop\"/>\n",
"\t</filter>\n",
"</defs>\n",
"<g color=\"white\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"\t<g shape-rendering=\"crispEdges\" stroke=\"none\">\n",
"\t\t<polygon fill=\"rgb(255, 255, 255)\" points=\"45.6,384.0 534.9,384.0 534.9,16.8 45.6,16.8 \"/>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"rgb(255, 255, 255)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,384.0 L58.1,384.0 M535.0,384.0 L522.5,384.0 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,390.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,322.8 L58.1,322.8 M535.0,322.8 L522.5,322.8 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,328.8)\">\n",
"\t\t<text><tspan font-family=\"{}\">20</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,261.6 L58.1,261.6 M535.0,261.6 L522.5,261.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,267.6)\">\n",
"\t\t<text><tspan font-family=\"{}\">40</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,200.3 L58.1,200.3 M535.0,200.3 L522.5,200.3 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,206.3)\">\n",
"\t\t<text><tspan font-family=\"{}\">60</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,139.1 L58.1,139.1 M535.0,139.1 L522.5,139.1 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,145.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">80</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,77.9 L58.1,77.9 M535.0,77.9 L522.5,77.9 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,83.9)\">\n",
"\t\t<text><tspan font-family=\"{}\">100</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,16.7 L58.1,16.7 M535.0,16.7 L522.5,16.7 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,22.7)\">\n",
"\t\t<text><tspan font-family=\"{}\">120</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,384.0 L45.6,371.5 M45.6,16.7 L45.6,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(45.6,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M168.0,384.0 L168.0,371.5 M168.0,16.7 L168.0,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(168.0,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M290.3,384.0 L290.3,371.5 M290.3,16.7 L290.3,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(290.3,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">10</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M412.7,384.0 L412.7,371.5 M412.7,16.7 L412.7,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(412.7,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">15</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M535.0,384.0 L535.0,371.5 M535.0,16.7 L535.0,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(535.0,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">20</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,16.7 L45.6,384.0 L535.0,384.0 L535.0,16.7 L45.6,16.7 Z \" stroke=\"black\"/></g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"\t<g id=\"gnuplot_plot_1a\"><title>gnuplot_plot_1a</title>\n",
"<g color=\"white\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<g onmousemove=\"gnuplot_svg.showHypertext(evt,'')\" onmouseout=\"gnuplot_svg.hideHypertext()\"><title> </title>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(45.6,318.2) scale(12.00)\" xlink:href=\"#gpPt5\"/></g>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(94.5,320.2) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(143.5,313.0) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(192.4,314.5) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(241.4,291.4) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(290.3,261.2) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(339.2,251.4) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(388.2,216.3) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(437.1,167.0) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(486.1,110.1) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(535.0,86.2) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"</g>\n",
"\t</g>\n",
"\t<g id=\"gnuplot_plot_2a\"><title>gnuplot_plot_2a</title>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<path d=\"M45.6,318.5 L50.5,319.0 L55.5,319.4 L60.4,319.7 L65.4,320.0 L70.3,320.3 L75.3,320.4 L80.2,320.6 L85.1,320.6 L90.1,320.6 L95.0,320.5 L100.0,320.4 L104.9,320.2 L109.9,320.0 L114.8,319.7 L119.8,319.3 L124.7,318.9 L129.6,318.4 L134.6,317.9 L139.5,317.3 L144.5,316.6 L149.4,315.9 L154.4,315.1 L159.3,314.3 L164.2,313.4 L169.2,312.4 L174.1,311.4 L179.1,310.3 L184.0,309.2 L189.0,308.0 L193.9,306.7 L198.8,305.4 L203.8,304.0 L208.7,302.6 L213.7,301.1 L218.6,299.5 L223.6,297.9 L228.5,296.2 L233.5,294.5 L238.4,292.7 L243.3,290.8 L248.3,288.9 L253.2,286.9 L258.2,284.9 L263.1,282.8 L268.1,280.6 L273.0,278.4 L277.9,276.1 L282.9,273.8 L287.8,271.4 L292.8,268.9 L297.7,266.4 L302.7,263.9 L307.6,261.2 L312.5,258.5 L317.5,255.8 L322.4,253.0 L327.4,250.1 L332.3,247.1 L337.3,244.2 L342.2,241.1 L347.1,238.0 L352.1,234.8 L357.0,231.6 L362.0,228.3 L366.9,224.9 L371.9,221.5 L376.8,218.0 L381.8,214.5 L386.7,210.9 L391.6,207.3 L396.6,203.6 L401.5,199.8 L406.5,196.0 L411.4,192.1 L416.4,188.1 L421.3,184.1 L426.2,180.0 L431.2,175.9 L436.1,171.7 L441.1,167.5 L446.0,163.2 L451.0,158.8 L455.9,154.4 L460.8,149.9 L465.8,145.3 L470.7,140.7 L475.7,136.0 L480.6,131.3 L485.6,126.5 L490.5,121.7 L495.5,116.8 L500.4,111.8 L505.3,106.8 L510.3,101.7 L515.2,96.5 L520.2,91.3 L525.1,86.1 L530.1,80.7 L535.0,75.4 \" stroke=\"rgb( 0, 128, 0)\"/></g>\n",
"\t</g>\n",
"\t<g id=\"gnuplot_plot_3a\"><title>gnuplot_plot_3a</title>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<path d=\"M45.6,362.4 L50.5,360.0 L55.5,357.5 L60.4,355.1 L65.4,352.6 L70.3,350.2 L75.3,347.7 L80.2,345.3 L85.1,342.8 L90.1,340.3 L95.0,337.9 L100.0,335.4 L104.9,333.0 L109.9,330.5 L114.8,328.1 L119.8,325.6 L124.7,323.2 L129.6,320.7 L134.6,318.2 L139.5,315.8 L144.5,313.3 L149.4,310.9 L154.4,308.4 L159.3,306.0 L164.2,303.5 L169.2,301.0 L174.1,298.6 L179.1,296.1 L184.0,293.7 L189.0,291.2 L193.9,288.8 L198.8,286.3 L203.8,283.9 L208.7,281.4 L213.7,278.9 L218.6,276.5 L223.6,274.0 L228.5,271.6 L233.5,269.1 L238.4,266.7 L243.3,264.2 L248.3,261.8 L253.2,259.3 L258.2,256.8 L263.1,254.4 L268.1,251.9 L273.0,249.5 L277.9,247.0 L282.9,244.6 L287.8,242.1 L292.8,239.7 L297.7,237.2 L302.7,234.7 L307.6,232.3 L312.5,229.8 L317.5,227.4 L322.4,224.9 L327.4,222.5 L332.3,220.0 L337.3,217.5 L342.2,215.1 L347.1,212.6 L352.1,210.2 L357.0,207.7 L362.0,205.3 L366.9,202.8 L371.9,200.4 L376.8,197.9 L381.8,195.4 L386.7,193.0 L391.6,190.5 L396.6,188.1 L401.5,185.6 L406.5,183.2 L411.4,180.7 L416.4,178.3 L421.3,175.8 L426.2,173.3 L431.2,170.9 L436.1,168.4 L441.1,166.0 L446.0,163.5 L451.0,161.1 L455.9,158.6 L460.8,156.2 L465.8,153.7 L470.7,151.2 L475.7,148.8 L480.6,146.3 L485.6,143.9 L490.5,141.4 L495.5,139.0 L500.4,136.5 L505.3,134.0 L510.3,131.6 L515.2,129.1 L520.2,126.7 L525.1,124.2 L530.1,121.8 L535.0,119.3 \" stroke=\"rgb(255, 0, 0)\"/></g>\n",
"\t</g>\n",
"<g color=\"white\" fill=\"none\" stroke=\"rgb(255, 0, 0)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"Z=[ones(size(x)) x];\n",
"a_line=Z\\y;\n",
"x_fcn=linspace(min(x),max(x));\n",
"plot(x,y,'o',x_fcn,a(1)+a(2)*x_fcn+a(3)*x_fcn.^2,...\n",
"x_fcn,a_line(1)+a_line(2)*x_fcn)\n",
"St=std(y)\n",
"Sr=std(y-a_line(1)-a_line(2)*x)\n",
"r2=1-Sr/St;\n",
"r=sqrt(r2);\n",
"\n",
"fprintf('the coefficient of determination for this fit is %f',r2)\n",
"fprintf('the correlation coefficient this fit is %f',r)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"420px\" viewBox=\"0 0 560 420\" width=\"560px\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"\n",
"<title>Gnuplot</title>\n",
"<desc>Produced by GNUPLOT 5.0 patchlevel 3 </desc>\n",
"\n",
"<g id=\"gnuplot_canvas\">\n",
"\n",
"<rect fill=\"none\" height=\"420\" width=\"560\" x=\"0\" y=\"0\"/>\n",
"<defs>\n",
"\n",
"\t<circle id=\"gpDot\" r=\"0.5\" stroke-width=\"0.5\"/>\n",
"\t<path d=\"M-1,0 h2 M0,-1 v2\" id=\"gpPt0\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,-1 L1,1 M1,-1 L-1,1\" id=\"gpPt1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1\" id=\"gpPt2\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<rect height=\"2\" id=\"gpPt3\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<rect fill=\"currentColor\" height=\"2\" id=\"gpPt4\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<circle cx=\"0\" cy=\"0\" id=\"gpPt5\" r=\"1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt6\" stroke=\"none\" xlink:href=\"#gpPt5\"/>\n",
"\t<path d=\"M0,-1.33 L-1.33,0.67 L1.33,0.67 z\" id=\"gpPt7\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt8\" stroke=\"none\" xlink:href=\"#gpPt7\"/>\n",
"\t<use id=\"gpPt9\" stroke=\"currentColor\" transform=\"rotate(180)\" xlink:href=\"#gpPt7\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt10\" stroke=\"none\" xlink:href=\"#gpPt9\"/>\n",
"\t<use id=\"gpPt11\" stroke=\"currentColor\" transform=\"rotate(45)\" xlink:href=\"#gpPt3\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt12\" stroke=\"none\" xlink:href=\"#gpPt11\"/>\n",
"\t<path d=\"M0,1.330 L1.265,0.411 L0.782,-1.067 L-0.782,-1.076 L-1.265,0.411 z\" id=\"gpPt13\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt14\" stroke=\"none\" xlink:href=\"#gpPt13\"/>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"textbox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"white\" flood-opacity=\"1\" result=\"bgnd\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"bgnd\" operator=\"atop\"/>\n",
"\t</filter>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"greybox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"lightgrey\" flood-opacity=\"1\" result=\"grey\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"grey\" operator=\"atop\"/>\n",
"\t</filter>\n",
"</defs>\n",
"<g color=\"white\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"\t<g shape-rendering=\"crispEdges\" stroke=\"none\">\n",
"\t\t<polygon fill=\"rgb(255, 255, 255)\" points=\"45.6,384.0 534.9,384.0 534.9,60.2 45.6,60.2 \"/>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"rgb(255, 255, 255)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,384.0 L58.1,384.0 M535.0,384.0 L522.5,384.0 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,390.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">-15</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,330.0 L58.1,330.0 M535.0,330.0 L522.5,330.0 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,336.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">-10</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,276.0 L58.1,276.0 M535.0,276.0 L522.5,276.0 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,282.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">-5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,222.0 L58.1,222.0 M535.0,222.0 L522.5,222.0 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,228.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,168.1 L58.1,168.1 M535.0,168.1 L522.5,168.1 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,174.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,114.1 L58.1,114.1 M535.0,114.1 L522.5,114.1 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,120.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">10</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,60.1 L58.1,60.1 M535.0,60.1 L522.5,60.1 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,66.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">15</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,384.0 L45.6,371.5 M45.6,60.1 L45.6,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(45.6,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M168.0,384.0 L168.0,371.5 M168.0,60.1 L168.0,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(168.0,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M290.3,384.0 L290.3,371.5 M290.3,60.1 L290.3,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(290.3,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">10</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M412.7,384.0 L412.7,371.5 M412.7,60.1 L412.7,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(412.7,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">15</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M535.0,384.0 L535.0,371.5 M535.0,60.1 L535.0,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(535.0,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">20</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,60.1 L45.6,384.0 L535.0,384.0 L535.0,60.1 L45.6,60.1 Z \" stroke=\"black\"/></g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(290.3,33.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">residuals of straight line</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"\t<g id=\"gnuplot_plot_1a\"><title>gnuplot_plot_1a</title>\n",
"<g color=\"white\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<path d=\"M45.6,65.9 L94.5,158.8 L143.5,219.2 L192.4,310.3 L241.4,314.3 L290.3,293.8 L339.2,345.1 L388.2,306.9 L437.1,218.9 L486.1,103.8 L535.0,105.4 \" stroke=\"rgb( 0, 0, 255)\"/></g>\n",
"\t</g>\n",
"<g color=\"white\" fill=\"none\" stroke=\"rgb( 0, 0, 255)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plot(x,y-a_line(1)-a_line(2)*x)\n",
"title('residuals of straight line')"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"420px\" viewBox=\"0 0 560 420\" width=\"560px\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"\n",
"<title>Gnuplot</title>\n",
"<desc>Produced by GNUPLOT 5.0 patchlevel 3 </desc>\n",
"\n",
"<g id=\"gnuplot_canvas\">\n",
"\n",
"<rect fill=\"none\" height=\"420\" width=\"560\" x=\"0\" y=\"0\"/>\n",
"<defs>\n",
"\n",
"\t<circle id=\"gpDot\" r=\"0.5\" stroke-width=\"0.5\"/>\n",
"\t<path d=\"M-1,0 h2 M0,-1 v2\" id=\"gpPt0\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,-1 L1,1 M1,-1 L-1,1\" id=\"gpPt1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1\" id=\"gpPt2\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<rect height=\"2\" id=\"gpPt3\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<rect fill=\"currentColor\" height=\"2\" id=\"gpPt4\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<circle cx=\"0\" cy=\"0\" id=\"gpPt5\" r=\"1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt6\" stroke=\"none\" xlink:href=\"#gpPt5\"/>\n",
"\t<path d=\"M0,-1.33 L-1.33,0.67 L1.33,0.67 z\" id=\"gpPt7\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt8\" stroke=\"none\" xlink:href=\"#gpPt7\"/>\n",
"\t<use id=\"gpPt9\" stroke=\"currentColor\" transform=\"rotate(180)\" xlink:href=\"#gpPt7\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt10\" stroke=\"none\" xlink:href=\"#gpPt9\"/>\n",
"\t<use id=\"gpPt11\" stroke=\"currentColor\" transform=\"rotate(45)\" xlink:href=\"#gpPt3\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt12\" stroke=\"none\" xlink:href=\"#gpPt11\"/>\n",
"\t<path d=\"M0,1.330 L1.265,0.411 L0.782,-1.067 L-0.782,-1.076 L-1.265,0.411 z\" id=\"gpPt13\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt14\" stroke=\"none\" xlink:href=\"#gpPt13\"/>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"textbox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"white\" flood-opacity=\"1\" result=\"bgnd\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"bgnd\" operator=\"atop\"/>\n",
"\t</filter>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"greybox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"lightgrey\" flood-opacity=\"1\" result=\"grey\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"grey\" operator=\"atop\"/>\n",
"\t</filter>\n",
"</defs>\n",
"<g color=\"white\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"\t<g shape-rendering=\"crispEdges\" stroke=\"none\">\n",
"\t\t<polygon fill=\"rgb(255, 255, 255)\" points=\"37.3,384.0 534.9,384.0 534.9,60.2 37.3,60.2 \"/>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"rgb(255, 255, 255)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,384.0 L49.8,384.0 M535.0,384.0 L522.5,384.0 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,390.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">-4</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,319.2 L49.8,319.2 M535.0,319.2 L522.5,319.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,325.2)\">\n",
"\t\t<text><tspan font-family=\"{}\">-2</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,254.4 L49.8,254.4 M535.0,254.4 L522.5,254.4 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,260.4)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,189.7 L49.8,189.7 M535.0,189.7 L522.5,189.7 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,195.7)\">\n",
"\t\t<text><tspan font-family=\"{}\">2</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,124.9 L49.8,124.9 M535.0,124.9 L522.5,124.9 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,130.9)\">\n",
"\t\t<text><tspan font-family=\"{}\">4</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,60.1 L49.8,60.1 M535.0,60.1 L522.5,60.1 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(29.0,66.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">6</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,384.0 L37.3,371.5 M37.3,60.1 L37.3,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(37.3,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M161.7,384.0 L161.7,371.5 M161.7,60.1 L161.7,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(161.7,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M286.2,384.0 L286.2,371.5 M286.2,60.1 L286.2,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(286.2,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">10</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M410.6,384.0 L410.6,371.5 M410.6,60.1 L410.6,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(410.6,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">15</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M535.0,384.0 L535.0,371.5 M535.0,60.1 L535.0,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(535.0,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">20</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M37.3,60.1 L37.3,384.0 L535.0,384.0 L535.0,60.1 L37.3,60.1 Z \" stroke=\"black\"/></g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(286.1,33.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">residuals of parabola</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"\t<g id=\"gnuplot_plot_1a\"><title>gnuplot_plot_1a</title>\n",
"<g color=\"white\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<path d=\"M37.3,251.3 L87.1,250.8 L136.8,214.9 L186.6,333.2 L236.4,252.2 L286.2,159.7 L335.9,344.5 L385.7,322.9 L435.5,213.9 L485.2,85.8 L535.0,369.6 \" stroke=\"rgb( 0, 0, 255)\"/></g>\n",
"\t</g>\n",
"<g color=\"white\" fill=\"none\" stroke=\"rgb( 0, 0, 255)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plot(x,y-a(1)-a(2)*x-a(3)*x.^2)\n",
"title('residuals of parabola')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Warning \n",
"**Coefficient of determination reduction does not always mean a better fit**\n",
"\n",
"Try the function, \n",
"\n",
"$y(x)=a_0+a_{1}x+a_{2}x^{2}+a_{4}x^{4}+a_{5}x^{5}+a_{5}x^{5}+a_{6}x^{6}+a_{7}x^{7}+a_{8}x^{8}$"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"a_overfit =\n",
"\n",
" 2.1487e+01\n",
" -1.4264e+01\n",
" 1.5240e+01\n",
" -6.0483e+00\n",
" 1.1887e+00\n",
" -1.2651e-01\n",
" 7.4379e-03\n",
" -2.2702e-04\n",
" 2.8063e-06\n",
"\n"
]
}
],
"source": [
"Z=[ones(size(x)) x x.^2 x.^3 x.^4 x.^5 x.^6 x.^7 x.^8];\n",
"a_overfit=Z\\y"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"420px\" viewBox=\"0 0 560 420\" width=\"560px\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"\n",
"<title>Gnuplot</title>\n",
"<desc>Produced by GNUPLOT 5.0 patchlevel 3 </desc>\n",
"\n",
"<g id=\"gnuplot_canvas\">\n",
"\n",
"<rect fill=\"none\" height=\"420\" width=\"560\" x=\"0\" y=\"0\"/>\n",
"<defs>\n",
"\n",
"\t<circle id=\"gpDot\" r=\"0.5\" stroke-width=\"0.5\"/>\n",
"\t<path d=\"M-1,0 h2 M0,-1 v2\" id=\"gpPt0\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,-1 L1,1 M1,-1 L-1,1\" id=\"gpPt1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1\" id=\"gpPt2\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<rect height=\"2\" id=\"gpPt3\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<rect fill=\"currentColor\" height=\"2\" id=\"gpPt4\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<circle cx=\"0\" cy=\"0\" id=\"gpPt5\" r=\"1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt6\" stroke=\"none\" xlink:href=\"#gpPt5\"/>\n",
"\t<path d=\"M0,-1.33 L-1.33,0.67 L1.33,0.67 z\" id=\"gpPt7\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt8\" stroke=\"none\" xlink:href=\"#gpPt7\"/>\n",
"\t<use id=\"gpPt9\" stroke=\"currentColor\" transform=\"rotate(180)\" xlink:href=\"#gpPt7\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt10\" stroke=\"none\" xlink:href=\"#gpPt9\"/>\n",
"\t<use id=\"gpPt11\" stroke=\"currentColor\" transform=\"rotate(45)\" xlink:href=\"#gpPt3\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt12\" stroke=\"none\" xlink:href=\"#gpPt11\"/>\n",
"\t<path d=\"M0,1.330 L1.265,0.411 L0.782,-1.067 L-0.782,-1.076 L-1.265,0.411 z\" id=\"gpPt13\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt14\" stroke=\"none\" xlink:href=\"#gpPt13\"/>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"textbox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"white\" flood-opacity=\"1\" result=\"bgnd\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"bgnd\" operator=\"atop\"/>\n",
"\t</filter>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"greybox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"lightgrey\" flood-opacity=\"1\" result=\"grey\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"grey\" operator=\"atop\"/>\n",
"\t</filter>\n",
"</defs>\n",
"<g color=\"white\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"\t<g shape-rendering=\"crispEdges\" stroke=\"none\">\n",
"\t\t<polygon fill=\"rgb(255, 255, 255)\" points=\"45.6,384.0 534.9,384.0 534.9,16.8 45.6,16.8 \"/>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"rgb(255, 255, 255)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,384.0 L58.1,384.0 M535.0,384.0 L522.5,384.0 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,390.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,322.8 L58.1,322.8 M535.0,322.8 L522.5,322.8 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,328.8)\">\n",
"\t\t<text><tspan font-family=\"{}\">20</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,261.6 L58.1,261.6 M535.0,261.6 L522.5,261.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,267.6)\">\n",
"\t\t<text><tspan font-family=\"{}\">40</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,200.3 L58.1,200.3 M535.0,200.3 L522.5,200.3 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,206.3)\">\n",
"\t\t<text><tspan font-family=\"{}\">60</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,139.1 L58.1,139.1 M535.0,139.1 L522.5,139.1 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,145.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">80</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,77.9 L58.1,77.9 M535.0,77.9 L522.5,77.9 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,83.9)\">\n",
"\t\t<text><tspan font-family=\"{}\">100</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,16.7 L58.1,16.7 M535.0,16.7 L522.5,16.7 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(37.3,22.7)\">\n",
"\t\t<text><tspan font-family=\"{}\">120</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,384.0 L45.6,371.5 M45.6,16.7 L45.6,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(45.6,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M168.0,384.0 L168.0,371.5 M168.0,16.7 L168.0,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(168.0,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M290.3,384.0 L290.3,371.5 M290.3,16.7 L290.3,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(290.3,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">10</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M412.7,384.0 L412.7,371.5 M412.7,16.7 L412.7,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(412.7,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">15</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M535.0,384.0 L535.0,371.5 M535.0,16.7 L535.0,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(535.0,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">20</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M45.6,16.7 L45.6,384.0 L535.0,384.0 L535.0,16.7 L45.6,16.7 Z \" stroke=\"black\"/></g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"\t<path d=\"M53.9,169.7 L53.9,25.7 L219.7,25.7 L219.7,169.7 L53.9,169.7 Z \" stroke=\"black\"/></g>\n",
"\t<g id=\"gnuplot_plot_1a\"><title>data</title>\n",
"<g color=\"white\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(219.7,55.7)\">\n",
"\t\t<text><tspan font-family=\"{}\">data</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(45.6,318.2) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(94.5,320.2) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(143.5,313.0) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(192.4,314.5) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(241.4,291.4) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(290.3,261.2) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(339.2,251.4) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(388.2,216.3) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(437.1,167.0) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(486.1,110.1) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(535.0,86.2) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(92.0,49.7) scale(12.00)\" xlink:href=\"#gpPt5\"/>\n",
"</g>\n",
"\t</g>\n",
"\t<g id=\"gnuplot_plot_2a\"><title>parabola</title>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(219.7,103.7)\">\n",
"\t\t<text><tspan font-family=\"{}\">parabola</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<path d=\"M65.1,97.7 L118.9,97.7 M45.6,318.5 L50.5,319.0 L55.5,319.4 L60.4,319.7 L65.4,320.0 L70.3,320.3 L75.3,320.4 L80.2,320.6 L85.1,320.6 L90.1,320.6 L95.0,320.5 L100.0,320.4 L104.9,320.2 L109.9,320.0 L114.8,319.7 L119.8,319.3 L124.7,318.9 L129.6,318.4 L134.6,317.9 L139.5,317.3 L144.5,316.6 L149.4,315.9 L154.4,315.1 L159.3,314.3 L164.2,313.4 L169.2,312.4 L174.1,311.4 L179.1,310.3 L184.0,309.2 L189.0,308.0 L193.9,306.7 L198.8,305.4 L203.8,304.0 L208.7,302.6 L213.7,301.1 L218.6,299.5 L223.6,297.9 L228.5,296.2 L233.5,294.5 L238.4,292.7 L243.3,290.8 L248.3,288.9 L253.2,286.9 L258.2,284.9 L263.1,282.8 L268.1,280.6 L273.0,278.4 L277.9,276.1 L282.9,273.8 L287.8,271.4 L292.8,268.9 L297.7,266.4 L302.7,263.9 L307.6,261.2 L312.5,258.5 L317.5,255.8 L322.4,253.0 L327.4,250.1 L332.3,247.1 L337.3,244.2 L342.2,241.1 L347.1,238.0 L352.1,234.8 L357.0,231.6 L362.0,228.3 L366.9,224.9 L371.9,221.5 L376.8,218.0 L381.8,214.5 L386.7,210.9 L391.6,207.3 L396.6,203.6 L401.5,199.8 L406.5,196.0 L411.4,192.1 L416.4,188.1 L421.3,184.1 L426.2,180.0 L431.2,175.9 L436.1,171.7 L441.1,167.5 L446.0,163.2 L451.0,158.8 L455.9,154.4 L460.8,149.9 L465.8,145.3 L470.7,140.7 L475.7,136.0 L480.6,131.3 L485.6,126.5 L490.5,121.7 L495.5,116.8 L500.4,111.8 L505.3,106.8 L510.3,101.7 L515.2,96.5 L520.2,91.3 L525.1,86.1 L530.1,80.7 L535.0,75.4 \" stroke=\"rgb( 0, 128, 0)\"/></g>\n",
"\t</g>\n",
"\t<g id=\"gnuplot_plot_3a\"><title>n=8-fit</title>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(219.7,151.7)\">\n",
"\t\t<text><tspan font-family=\"{}\">n=8-fit</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<path d=\"M65.1,145.7 L118.9,145.7 M45.6,318.2 L50.5,325.3 L55.5,329.4 L60.4,331.2 L65.4,331.4 L70.3,330.4 L75.3,328.7 L80.2,326.5 L85.1,324.2 L90.1,321.8 L95.0,319.7 L100.0,317.8 L104.9,316.2 L109.9,314.9 L114.8,314.0 L119.8,313.4 L124.7,313.2 L129.6,313.1 L134.6,313.3 L139.5,313.7 L144.5,314.1 L149.4,314.6 L154.4,315.0 L159.3,315.4 L164.2,315.6 L169.2,315.7 L174.1,315.7 L179.1,315.3 L184.0,314.8 L189.0,314.0 L193.9,312.9 L198.8,311.5 L203.8,309.9 L208.7,308.1 L213.7,306.0 L218.6,303.7 L223.6,301.3 L228.5,298.6 L233.5,295.9 L238.4,293.0 L243.3,290.1 L248.3,287.1 L253.2,284.2 L258.2,281.2 L263.1,278.3 L268.1,275.5 L273.0,272.8 L277.9,270.2 L282.9,267.7 L287.8,265.3 L292.8,263.1 L297.7,261.0 L302.7,259.0 L307.6,257.2 L312.5,255.4 L317.5,253.7 L322.4,252.1 L327.4,250.5 L332.3,248.9 L337.3,247.3 L342.2,245.6 L347.1,243.8 L352.1,241.9 L357.0,239.8 L362.0,237.4 L366.9,234.9 L371.9,232.0 L376.8,228.9 L381.8,225.4 L386.7,221.6 L391.6,217.5 L396.6,213.0 L401.5,208.1 L406.5,202.9 L411.4,197.4 L416.4,191.6 L421.3,185.5 L426.2,179.3 L431.2,172.8 L436.1,166.3 L441.1,159.7 L446.0,153.2 L451.0,146.8 L455.9,140.5 L460.8,134.6 L465.8,128.9 L470.7,123.7 L475.7,118.9 L480.6,114.7 L485.6,111.0 L490.5,107.9 L495.5,105.3 L500.4,103.1 L505.3,101.4 L510.3,99.9 L515.2,98.4 L520.2,96.6 L525.1,94.3 L530.1,91.0 L535.0,86.2 \" stroke=\"rgb(255, 0, 0)\"/></g>\n",
"\t</g>\n",
"<g color=\"white\" fill=\"none\" stroke=\"rgb(255, 0, 0)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plot(x,y,'o',x_fcn,a(1)+a(2)*x_fcn+a(3)*x_fcn.^2,...\n",
"x_fcn,a_overfit(1)+a_overfit(2)*x_fcn+a_overfit(3)*x_fcn.^2+...\n",
"a_overfit(4)*x_fcn.^3+a_overfit(5)*x_fcn.^4+...\n",
"a_overfit(6)*x_fcn.^5+a_overfit(7)*x_fcn.^6+...\n",
"a_overfit(8)*x_fcn.^7+a_overfit(9)*x_fcn.^8)\n",
"legend('data','parabola','n=8-fit','Location','NorthWest')"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"St = 27.923\n",
"Sr = 0.77320\n",
"the coefficient of determination for this fit is 0.972309\n",
"the correlation coefficient this fit is 0.986057\n"
]
}
],
"source": [
"St=std(y)\n",
"Sr=std(y-polyval(a_overfit(end:-1:1),x))\n",
"r2=1-Sr/St;\n",
"r=sqrt(r2);\n",
"\n",
"fprintf('the coefficient of determination for this fit is %f',r2)\n",
"fprintf('the correlation coefficient this fit is %f',r)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Linear Regression is only limited by the ability to separate the parameters from the function to achieve\n",
"\n",
"$y=[Z]a$\n",
"\n",
"$Z$ can be any function of the independent variable(s)\n",
"\n",
"**Example**:\n",
"We assume two functions are added together, sin(t) and sin(3t). What are the amplitudes?\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"420px\" viewBox=\"0 0 560 420\" width=\"560px\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"\n",
"<title>Gnuplot</title>\n",
"<desc>Produced by GNUPLOT 5.0 patchlevel 3 </desc>\n",
"\n",
"<g id=\"gnuplot_canvas\">\n",
"\n",
"<rect fill=\"none\" height=\"420\" width=\"560\" x=\"0\" y=\"0\"/>\n",
"<defs>\n",
"\n",
"\t<circle id=\"gpDot\" r=\"0.5\" stroke-width=\"0.5\"/>\n",
"\t<path d=\"M-1,0 h2 M0,-1 v2\" id=\"gpPt0\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,-1 L1,1 M1,-1 L-1,1\" id=\"gpPt1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1\" id=\"gpPt2\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<rect height=\"2\" id=\"gpPt3\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<rect fill=\"currentColor\" height=\"2\" id=\"gpPt4\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<circle cx=\"0\" cy=\"0\" id=\"gpPt5\" r=\"1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt6\" stroke=\"none\" xlink:href=\"#gpPt5\"/>\n",
"\t<path d=\"M0,-1.33 L-1.33,0.67 L1.33,0.67 z\" id=\"gpPt7\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt8\" stroke=\"none\" xlink:href=\"#gpPt7\"/>\n",
"\t<use id=\"gpPt9\" stroke=\"currentColor\" transform=\"rotate(180)\" xlink:href=\"#gpPt7\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt10\" stroke=\"none\" xlink:href=\"#gpPt9\"/>\n",
"\t<use id=\"gpPt11\" stroke=\"currentColor\" transform=\"rotate(45)\" xlink:href=\"#gpPt3\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt12\" stroke=\"none\" xlink:href=\"#gpPt11\"/>\n",
"\t<path d=\"M0,1.330 L1.265,0.411 L0.782,-1.067 L-0.782,-1.076 L-1.265,0.411 z\" id=\"gpPt13\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt14\" stroke=\"none\" xlink:href=\"#gpPt13\"/>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"textbox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"white\" flood-opacity=\"1\" result=\"bgnd\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"bgnd\" operator=\"atop\"/>\n",
"\t</filter>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"greybox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"lightgrey\" flood-opacity=\"1\" result=\"grey\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"grey\" operator=\"atop\"/>\n",
"\t</filter>\n",
"</defs>\n",
"<g color=\"white\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"\t<g shape-rendering=\"crispEdges\" stroke=\"none\">\n",
"\t\t<polygon fill=\"rgb(255, 255, 255)\" points=\"53.9,384.0 534.9,384.0 534.9,16.8 53.9,16.8 \"/>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"rgb(255, 255, 255)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,384.0 L66.4,384.0 M535.0,384.0 L522.5,384.0 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(45.6,390.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">-1.5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,322.8 L66.4,322.8 M535.0,322.8 L522.5,322.8 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(45.6,328.8)\">\n",
"\t\t<text><tspan font-family=\"{}\">-1</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,261.6 L66.4,261.6 M535.0,261.6 L522.5,261.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(45.6,267.6)\">\n",
"\t\t<text><tspan font-family=\"{}\">-0.5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,200.3 L66.4,200.3 M535.0,200.3 L522.5,200.3 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(45.6,206.3)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,139.1 L66.4,139.1 M535.0,139.1 L522.5,139.1 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(45.6,145.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">0.5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,77.9 L66.4,77.9 M535.0,77.9 L522.5,77.9 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(45.6,83.9)\">\n",
"\t\t<text><tspan font-family=\"{}\">1</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,16.7 L66.4,16.7 M535.0,16.7 L522.5,16.7 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(45.6,22.7)\">\n",
"\t\t<text><tspan font-family=\"{}\">1.5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,384.0 L53.9,371.5 M53.9,16.7 L53.9,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(53.9,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M122.6,384.0 L122.6,371.5 M122.6,16.7 L122.6,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(122.6,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">2</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M191.4,384.0 L191.4,371.5 M191.4,16.7 L191.4,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(191.4,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">4</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M260.1,384.0 L260.1,371.5 M260.1,16.7 L260.1,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(260.1,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">6</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M328.8,384.0 L328.8,371.5 M328.8,16.7 L328.8,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(328.8,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">8</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M397.5,384.0 L397.5,371.5 M397.5,16.7 L397.5,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(397.5,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">10</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M466.3,384.0 L466.3,371.5 M466.3,16.7 L466.3,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(466.3,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">12</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M535.0,384.0 L535.0,371.5 M535.0,16.7 L535.0,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(535.0,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">14</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,16.7 L53.9,384.0 L535.0,384.0 L535.0,16.7 L53.9,16.7 Z \" stroke=\"black\"/></g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"\t<g id=\"gnuplot_plot_1a\"><title>gnuplot_plot_1a</title>\n",
"<g color=\"white\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<path d=\"M53.9,189.1 L58.3,158.8 L62.6,123.4 L67.0,106.4 L71.3,71.7 L75.7,81.5 L80.1,79.8 L84.4,74.7 L88.8,95.9 L93.2,115.8 L97.5,132.9 L101.9,138.9 L106.2,136.0 L110.6,128.5 L115.0,134.1 L119.3,113.1 L123.7,100.6 L128.1,80.3 L132.4,84.7 L136.8,69.7 L141.1,59.3 L145.5,90.2 L149.9,105.2 L154.2,127.8 L158.6,162.5 L162.9,200.5 L167.3,242.8 L171.7,269.5 L176.0,299.8 L180.4,330.0 L184.8,339.1 L189.1,337.5 L193.5,309.1 L197.8,317.2 L202.2,283.8 L206.6,274.1 L210.9,259.0 L215.3,272.4 L219.7,260.8 L224.0,270.0 L228.4,292.4 L232.7,300.1 L237.1,317.1 L241.5,317.3 L245.8,321.1 L250.2,318.3 L254.6,324.6 L258.9,293.0 L263.3,251.5 L267.6,215.3 L272.0,173.9 L276.4,137.1 L280.7,105.2 L285.1,77.1 L289.4,85.8 L293.8,77.1 L298.2,64.2 L302.5,79.7 L306.9,95.7 L311.3,123.7 L315.6,123.4 L320.0,148.0 L324.3,127.6 L328.7,141.7 L333.1,112.5 L337.4,110.2 L341.8,89.1 L346.2,85.4 L350.5,61.8 L354.9,69.0 L359.2,71.6 L363.6,85.1 L368.0,114.8 L372.3,151.0 L376.7,183.6 L381.0,217.9 L385.4,257.2 L389.8,285.4 L394.1,327.0 L398.5,335.3 L402.9,338.6 L407.2,327.6 L411.6,304.9 L415.9,286.3 L420.3,284.2 L424.7,275.5 L429.0,257.9 L433.4,273.2 L437.8,273.4 L442.1,269.8 L446.5,288.3 L450.8,317.0 L455.2,315.1 L459.6,342.1 L463.9,327.5 L468.3,326.7 L472.6,303.8 L477.0,269.1 L481.4,235.1 L485.7,210.5 \" stroke=\"rgb( 0, 0, 255)\"/></g>\n",
"\t</g>\n",
"<g color=\"white\" fill=\"none\" stroke=\"rgb( 0, 0, 255)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"load sin_data.csv\n",
"t=sin_data(1,:)';\n",
"y=sin_data(2,:)';\n",
"plot(t,y)"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"a =\n",
"\n",
" 0.99727\n",
" 0.50251\n",
"\n"
]
}
],
"source": [
"Z=[sin(t) sin(3*t)];\n",
"a=Z\\y"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"420px\" viewBox=\"0 0 560 420\" width=\"560px\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"\n",
"<title>Gnuplot</title>\n",
"<desc>Produced by GNUPLOT 5.0 patchlevel 3 </desc>\n",
"\n",
"<g id=\"gnuplot_canvas\">\n",
"\n",
"<rect fill=\"none\" height=\"420\" width=\"560\" x=\"0\" y=\"0\"/>\n",
"<defs>\n",
"\n",
"\t<circle id=\"gpDot\" r=\"0.5\" stroke-width=\"0.5\"/>\n",
"\t<path d=\"M-1,0 h2 M0,-1 v2\" id=\"gpPt0\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,-1 L1,1 M1,-1 L-1,1\" id=\"gpPt1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1\" id=\"gpPt2\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<rect height=\"2\" id=\"gpPt3\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<rect fill=\"currentColor\" height=\"2\" id=\"gpPt4\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<circle cx=\"0\" cy=\"0\" id=\"gpPt5\" r=\"1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt6\" stroke=\"none\" xlink:href=\"#gpPt5\"/>\n",
"\t<path d=\"M0,-1.33 L-1.33,0.67 L1.33,0.67 z\" id=\"gpPt7\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt8\" stroke=\"none\" xlink:href=\"#gpPt7\"/>\n",
"\t<use id=\"gpPt9\" stroke=\"currentColor\" transform=\"rotate(180)\" xlink:href=\"#gpPt7\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt10\" stroke=\"none\" xlink:href=\"#gpPt9\"/>\n",
"\t<use id=\"gpPt11\" stroke=\"currentColor\" transform=\"rotate(45)\" xlink:href=\"#gpPt3\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt12\" stroke=\"none\" xlink:href=\"#gpPt11\"/>\n",
"\t<path d=\"M0,1.330 L1.265,0.411 L0.782,-1.067 L-0.782,-1.076 L-1.265,0.411 z\" id=\"gpPt13\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt14\" stroke=\"none\" xlink:href=\"#gpPt13\"/>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"textbox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"white\" flood-opacity=\"1\" result=\"bgnd\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"bgnd\" operator=\"atop\"/>\n",
"\t</filter>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"greybox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"lightgrey\" flood-opacity=\"1\" result=\"grey\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"grey\" operator=\"atop\"/>\n",
"\t</filter>\n",
"</defs>\n",
"<g color=\"white\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"\t<g shape-rendering=\"crispEdges\" stroke=\"none\">\n",
"\t\t<polygon fill=\"rgb(255, 255, 255)\" points=\"53.9,384.0 534.9,384.0 534.9,16.8 53.9,16.8 \"/>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"rgb(255, 255, 255)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,384.0 L66.4,384.0 M535.0,384.0 L522.5,384.0 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(45.6,390.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">-1.5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,322.8 L66.4,322.8 M535.0,322.8 L522.5,322.8 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(45.6,328.8)\">\n",
"\t\t<text><tspan font-family=\"{}\">-1</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,261.6 L66.4,261.6 M535.0,261.6 L522.5,261.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(45.6,267.6)\">\n",
"\t\t<text><tspan font-family=\"{}\">-0.5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,200.3 L66.4,200.3 M535.0,200.3 L522.5,200.3 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(45.6,206.3)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,139.1 L66.4,139.1 M535.0,139.1 L522.5,139.1 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(45.6,145.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">0.5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,77.9 L66.4,77.9 M535.0,77.9 L522.5,77.9 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(45.6,83.9)\">\n",
"\t\t<text><tspan font-family=\"{}\">1</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,16.7 L66.4,16.7 M535.0,16.7 L522.5,16.7 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(45.6,22.7)\">\n",
"\t\t<text><tspan font-family=\"{}\">1.5</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,384.0 L53.9,371.5 M53.9,16.7 L53.9,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(53.9,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M122.6,384.0 L122.6,371.5 M122.6,16.7 L122.6,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(122.6,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">2</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M191.4,384.0 L191.4,371.5 M191.4,16.7 L191.4,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(191.4,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">4</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M260.1,384.0 L260.1,371.5 M260.1,16.7 L260.1,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(260.1,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">6</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M328.8,384.0 L328.8,371.5 M328.8,16.7 L328.8,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(328.8,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">8</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M397.5,384.0 L397.5,371.5 M397.5,16.7 L397.5,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(397.5,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">10</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M466.3,384.0 L466.3,371.5 M466.3,16.7 L466.3,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(466.3,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">12</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M535.0,384.0 L535.0,371.5 M535.0,16.7 L535.0,29.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(535.0,408.0)\">\n",
"\t\t<text><tspan font-family=\"{}\">14</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M53.9,16.7 L53.9,384.0 L535.0,384.0 L535.0,16.7 L53.9,16.7 Z \" stroke=\"black\"/></g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"\t<g id=\"gnuplot_plot_1a\"><title>gnuplot_plot_1a</title>\n",
"<g color=\"white\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<g onmousemove=\"gnuplot_svg.showHypertext(evt,'')\" onmouseout=\"gnuplot_svg.hideHypertext()\"><title> </title>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(53.9,189.1) scale(4.00)\" xlink:href=\"#gpPt6\"/></g>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(58.3,158.8) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(62.6,123.4) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(67.0,106.4) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(71.3,71.7) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(75.7,81.5) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(80.1,79.8) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(84.4,74.7) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(88.8,95.9) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(93.2,115.8) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(97.5,132.9) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(101.9,138.9) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(106.2,136.0) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(110.6,128.5) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(115.0,134.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(119.3,113.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(123.7,100.6) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(128.1,80.3) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(132.4,84.7) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(136.8,69.7) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(141.1,59.3) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(145.5,90.2) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(149.9,105.2) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(154.2,127.8) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(158.6,162.5) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(162.9,200.5) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(167.3,242.8) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(171.7,269.5) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(176.0,299.8) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(180.4,330.0) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(184.8,339.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(189.1,337.5) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(193.5,309.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(197.8,317.2) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(202.2,283.8) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(206.6,274.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(210.9,259.0) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(215.3,272.4) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(219.7,260.8) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(224.0,270.0) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(228.4,292.4) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(232.7,300.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(237.1,317.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(241.5,317.3) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(245.8,321.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(250.2,318.3) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(254.6,324.6) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(258.9,293.0) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(263.3,251.5) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(267.6,215.3) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(272.0,173.9) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(276.4,137.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(280.7,105.2) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(285.1,77.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(289.4,85.8) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(293.8,77.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(298.2,64.2) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(302.5,79.7) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(306.9,95.7) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(311.3,123.7) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(315.6,123.4) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(320.0,148.0) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(324.3,127.6) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(328.7,141.7) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(333.1,112.5) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(337.4,110.2) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(341.8,89.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(346.2,85.4) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(350.5,61.8) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(354.9,69.0) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(359.2,71.6) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(363.6,85.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(368.0,114.8) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(372.3,151.0) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(376.7,183.6) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(381.0,217.9) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(385.4,257.2) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(389.8,285.4) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(394.1,327.0) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(398.5,335.3) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(402.9,338.6) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(407.2,327.6) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(411.6,304.9) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(415.9,286.3) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(420.3,284.2) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(424.7,275.5) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(429.0,257.9) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(433.4,273.2) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(437.8,273.4) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(442.1,269.8) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(446.5,288.3) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(450.8,317.0) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(455.2,315.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(459.6,342.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(463.9,327.5) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(468.3,326.7) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(472.6,303.8) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(477.0,269.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(481.4,235.1) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"\t<use color=\"rgb( 0, 0, 255)\" transform=\"translate(485.7,210.5) scale(4.00)\" xlink:href=\"#gpPt6\"/>\n",
"</g>\n",
"\t</g>\n",
"\t<g id=\"gnuplot_plot_2a\"><title>gnuplot_plot_2a</title>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<path d=\"M53.9,200.3 L58.3,162.0 L62.6,127.2 L67.0,99.0 L71.3,79.5 L75.7,69.8 L80.1,69.6 L84.4,77.4 L88.8,90.8 L93.2,106.6 L97.5,121.8 L101.9,133.4 L106.2,139.3 L110.6,138.4 L115.0,131.0 L119.3,118.2 L123.7,102.6 L128.1,87.1 L132.4,74.8 L136.8,68.8 L141.1,71.3 L145.5,83.5 L149.9,105.3 L154.2,135.4 L158.6,171.4 L162.9,210.1 L167.3,247.8 L171.7,281.2 L176.0,307.4 L180.4,324.5 L184.8,331.8 L189.1,329.8 L193.5,320.4 L197.8,306.1 L202.2,290.1 L206.6,275.6 L210.9,265.2 L215.3,261.0 L219.7,263.6 L224.0,272.5 L228.4,286.2 L232.7,302.1 L237.1,317.1 L241.5,328.1 L245.8,332.1 L250.2,327.3 L254.6,312.6 L258.9,288.6 L263.3,256.7 L267.6,219.7 L272.0,181.0 L276.4,144.0 L280.7,112.1 L285.1,88.1 L289.4,73.4 L293.8,68.6 L298.2,72.6 L302.5,83.6 L306.9,98.6 L311.3,114.5 L315.6,128.2 L320.0,137.1 L324.3,139.7 L328.7,135.5 L333.1,125.1 L337.4,110.6 L341.8,94.6 L346.2,80.3 L350.5,70.9 L354.9,68.9 L359.2,76.2 L363.6,93.3 L368.0,119.5 L372.3,152.9 L376.7,190.6 L381.0,229.3 L385.4,265.3 L389.8,295.4 L394.1,317.2 L398.5,329.4 L402.9,331.9 L407.2,325.9 L411.6,313.6 L415.9,298.1 L420.3,282.5 L424.7,269.7 L429.0,262.3 L433.4,261.4 L437.8,267.3 L442.1,278.9 L446.5,294.1 L450.8,309.9 L455.2,323.3 L459.6,331.1 L463.9,330.9 L468.3,321.2 L472.6,301.7 L477.0,273.5 L481.4,238.7 L485.7,200.4 \" stroke=\"rgb( 0, 128, 0)\"/></g>\n",
"\t</g>\n",
"<g color=\"white\" fill=\"none\" stroke=\"rgb( 0, 128, 0)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plot(t,y,'.',t,a(1)*sin(t)+a(2)*sin(3*t))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Octave",
"language": "octave",
"name": "octave"
},
"language_info": {
"file_extension": ".m",
"help_links": [
{
"text": "MetaKernel Magics",
"url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
}
],
"mimetype": "text/x-octave",
"name": "octave",
"version": "0.19.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}