File:MDKQ6 anim.gif

頁面內容唔支援其他語言。
出自維基百科,自由嘅百科全書

MDKQ6_anim.gif(450 × 350 像素,檔案大細:42 KB ,MIME類型:image/gif、循環、10格、1.0 s)

摘要

描述
Deutsch: Teilbild einer Animation Polynomapproximation unterschiedlicher Polynomordnung
日期
來源 MDKQ anim.gif
作者 Johannes Kalliauer
Other versions File:MDKQ_anim.gif

協議

我,呢份作品嘅作者,決定用以下許可發佈呢件作品:
Creative Commons CC-Zero 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.

Quellen: Skript zur Bildgenerierung

Erzeugungsskript, um die Grafik zu erstellen.

Anleitung

Benötigte Open-Source-Software:

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

 
This plot was created with Matplotlib.
#This source code is public domain
#Created by Christian Schirm
#Edited by Johannes Kalliauer
import numpy, pylab
from matplotlib.font_manager import FontProperties
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from numpy.random import randn

x=[1,2,3,4,5,6]
y=[2.0,2.5,2.5,3.4,3.7,6.6]

for N in range(1,7):
   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:], label="Residuen")
   y0,=plt.plot(*residuen[-3:])
   plt.setp(y0, color='#80d080', linewidth=1.5)
   #y2=plt.plot(xneu,yneu,'r-', label="Modellfunktion")
   y2,=plt.plot(xneu,yneu,'r-')
   #y1=plt.plot(x,y,'o', label="Messpunkte")
   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)
   #leg = plt.legend(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)
   plt.savefig('test.eps', format='eps', dpi=900)
   plt.savefig("MDKQ_anim%i.svg"%N)

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

圖中顯示嘅係

25 6 2017

image/gif

檔案歷史

撳個日期/時間去睇響嗰個時間出現過嘅檔案。

日期/時間縮圖尺寸用戶註解
現時2017年6月25號 (日) 16:23響2017年6月25號 (日) 16:23嘅縮圖版本450 × 350(42 KB)JoKalliauer

以下嘅1版用到呢個檔:

全域檔案使用情況