File:MDKQ4.svg
Summary
Description |
Deutsch: Ausreißer bei linearer Approximation |
Date | |
Source | Own work, Neufassung von Ausreißer.png by Philipendula |
Author | Christian Schirm |
SVG development | |
Source code | Python code# This source code is public domain
import numpy, pylab
import matplotlib.pyplot as plt
x = [208, 152, 113, 227, 137, 238, 178, 104, 191, 130]
y = [21.6, 15.5, 10.4, 31.0, 13.0, 32.4, 19.0, 10.4, 19.0, 11.8]
N = 2
A = numpy.zeros((N,N))
for i in range(N):
for j in range(N):
A[i,j]=sum(xi**(i+j) for xi in x)
b = numpy.zeros((N))
for i in range(N):
b[i]=sum(xi**(i)*yi for xi,yi in zip(x,y))
c = numpy.linalg.solve(A, b)
#print numpy.std(numpy.asarray(y)-numpy.sum([c[i]*numpy.asarray(x)**i for i in range(len(c))],axis=0))
xneu = numpy.linspace(100, 250, num=2)
yneu = numpy.sum([c[i]*xneu**i for i in range(len(c))],axis=0)
fig = plt.figure(figsize=(4.2, 3.2))
y1 = plt.plot(x,y,'o')
y2 = plt.plot(xneu,yneu,'r-')
plt.xlabel(u'x (L\u00e4nge in m)')
plt.ylabel(u'y (Breite in m)')
leg = plt.legend(('Messpunkte','Modellfunktion'),frameon=True,loc='lower right')
plt.grid(True, alpha=0.7)
plt.tight_layout()
plt.savefig('MDKQ2.svg')
|
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
![]() ![]() |
This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. |
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
|