File:MDKQ anim.gif

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

MDKQ_anim.gif(504 × 384 pixels, file size: 53 KB, MIME type: image/gif, looped, 7 frames, 9.0 s)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description
Deutsch: Animation Polynomapproximation unterschiedlicher Polynomordnung
Date
Source Own work, Neufassung von File:Lsf.gif vom Benutzer en:User:J.N.
Author Christian Schirm
Other versions

Derivative works of this file:

GIF development
InfoField
 
This plot was created with Matplotlib.
Source code
InfoField

Python code

# This source code is public domain

import numpy
import matplotlib.pyplot as plt
import imageio

x = numpy.array([1,2,3,4,5,6,7])
y = numpy.array([2.0,2.5,2.5,3.4,3.7,6.6,3])

images = []
for nPoly in range(1,8):

    phi = numpy.array([x**i for i in range(nPoly)])
    A = phi @ phi.T
    b = phi @ y
    c = numpy.linalg.solve(A, b)
    yPoly = c @ phi
    residuen = []
    for i in range(len(x)): residuen+=[[x[i],x[i]],[y[i],yPoly[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.2, 3.2), dpi=120)
    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')
    plt.setp(y0, color='#80d080', linewidth=1.5)
    y2, = plt.plot(xneu,yneu,'r-',label='Modellfunktion')
    y1, = plt.plot(x,y,'o', label='Messpunkte')
    plt.xlabel('x')
    plt.ylabel('y')
    order = y1,y2,y0
    leg = plt.legend(order,[p.get_label() for p in order], frameon=True, loc='lower right')
    plt.grid(True, alpha=0.7)
    plt.axis([0, 8, 0, 8])
    plt.text(1,7, "Polynomgrad "+str(nPoly-1),bbox = dict(boxstyle="square,pad=0.5",color='white',ec='black',fill=True))
    plt.tight_layout()
    # plt.savefig('MDKQ_anim%i.png'%N)
    fig.canvas.draw()
    s, (width, height) = fig.canvas.print_to_buffer()
    images.append(numpy.array(list(s), numpy.uint8).reshape((height, width, 4)))
    fig.clf()
    plt.close('all')
    
# Save GIF animation
fileOut = 'MDKQ_animation.gif'
imageio.mimsave(fileOut, images, duration=[1,1,1,1,1,1,3])

# Optimize GIF size
from pygifsicle import optimize
optimize(fileOut, colors=16)

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following license:
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.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current12:34, 23 May 2021Thumbnail for version as of 12:34, 23 May 2021504 × 384 (53 KB)Physikinger (talk | contribs)Higher resolution
12:06, 23 May 2021Thumbnail for version as of 12:06, 23 May 2021420 × 320 (44 KB)Physikinger (talk | contribs)New Matplotlib version
17:22, 3 February 2011Thumbnail for version as of 17:22, 3 February 2011450 × 350 (26 KB)PhysikingerC (talk | contribs)Residuen
06:43, 3 February 2011Thumbnail for version as of 06:43, 3 February 2011450 × 350 (21 KB)PhysikingerC (talk | contribs)Ordnung korrigiert
18:37, 2 February 2011Thumbnail for version as of 18:37, 2 February 2011450 × 350 (22 KB)PhysikingerC (talk | contribs){{Information |Description ={{de|1=Animation Polynomapproximation unterschiedlicher Polynomordnung}} |Source ={{own}} |Author =Christian Schirm |Date =2011-02-02 |Permission = |other_versions = }}

There are no pages that use this file.

File usage on other wikis