File:MDKQ anim4.png
MDKQ_anim4.png (450 × 350 pixels, file size: 8 KB, MIME type: image/png)
File information
Structured data
Captions
Contents
Summary
editDescriptionMDKQ anim4.png |
Deutsch: Teilbild einer Animation Polynomapproximation unterschiedlicher Polynomordnung |
Date | |
Source | MDKQ anim.gif |
Author | Johannes Kalliauer |
Other versions | File:MDKQ_anim.gif |
Licensing
editI, 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.
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse |
Quellen: Skript zur Bildgenerierung
editErzeugungsskript, um die Grafik zu erstellen.
Anleitung
editBenötigte Open-Source-Software:
- Python
- Python-Paket: numpy
- Python-Paket: matplotlib
Nach der Installation von Python den Quelltext in eine Datei mdkq.py kopieren und starten durch Doppelklicken oder in der Konsole durch Eingabe von
python mdkq.py
Python-Skript
editThis plot was created with Matplotlib.
#This source code is public domain
import numpy, pylab
from matplotlib.font_manager import FontProperties
import matplotlib.pyplot as plt
x=[1,2,3,4,5,6,7]
y=[2.0,2.5,2.5,3.4,3.7,6.6,3]
for N in range(1,8):
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)
xr=numpy.asarray(x)
yr=numpy.sum([c[i]*xr**i for i in range(len(c))],axis=0)
residuen=[]
for i in range(len(x)): residuen+=[[xr[i],xr[i]],[y[i],yr[i]],'g-']
xneu=numpy.linspace(0, 8, num=100)
yneu=numpy.sum([c[i]*xneu**i for i in range(len(c))],axis=0)
plt.clf()
fig = plt.figure(figsize=(4.5, 3.5))
fig.subplotpars.bottom=0.13
y0=plt.plot(*residuen[:-3])
plt.setp(y0, color='#80d080', linewidth=1.5)
y0=plt.plot(*residuen[-3:])
plt.setp(y0, color='#80d080', linewidth=1.5)
y2=plt.plot(xneu,yneu,'r-')
y1=plt.plot(x,y,'o')
plt.xlabel('x')
plt.ylabel('y')
font = FontProperties()
font.set_size('medium')
leg = plt.legend([y1,y2,y0],['Messpunkte','Modellfunktion','Residuen'],frameon=True,loc='lower right',labelspacing=0.3,prop=font)
plt.grid(True)
plt.axis([0, 8, 0, 8])
plt.text(1,7, "Polynomgrad "+str(N-1),bbox=dict(boxstyle="square,pad=0.5",color='white',ec='black',fill=True))
#plt.show()
plt.savefig('MDKQ_anim%i.png'%N)
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 20:32, 22 June 2017 | 450 × 350 (8 KB) | JoKalliauer (talk | contribs) |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
File usage on other wikis
The following other wikis use this file:
- Usage on de.wikipedia.org