File:Mplwp window-functions-symmetric.svg

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

Original file(SVG file, nominally 600 × 400 pixels, file size: 51 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description
English: Plot of several window functions. The functions are shown symmetrically in the interval [-1,1]. The window functions are: Boxcar, Welch, Cos, Lanczos, Hamming, Hann, Blackman and Bartlett.
Date
Source Own work
Author Geek3
SVG development
InfoField
W3C grn 
The SVG code is valid.
Mplwp logo 
This plot was created with mplwp, the Matplotlib extension for Wikipedia plots.
Source code
InfoField

mplwp source code

The plot was generated with mplwp 1.6.4
#!/usr/bin/python
# -*- coding: utf8 -*-

import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from math import *

code_website = 'http://commons.wikimedia.org/wiki/User:Geek3/mplwp'
try:
    import mplwp
except ImportError, er:
    print 'ImportError:', er
    print 'You need to download mplwp.py from', code_website
    exit(1)

name = 'mplwp_window-functions-symmetric.svg'
fig = mplwp.fig_standard(mpl)

xlim = -1.05,1.05; fig.gca().set_xlim(xlim)
ylim = 0,1.04; fig.gca().set_ylim(ylim)
fig.gca().xaxis.set_major_locator(mpl.ticker.MultipleLocator(0.5))
mplwp.mark_axeszero(fig.gca())
l, r, t, b = (42.5, 16.5, 18.5, 26.5)
mplwp.set_bordersize(fig, l, r, t, b)

x = np.linspace(-1, 1, 5001)

plt.plot([-1, -1, 1, 1], [0, 1, 1, 0], label='Boxcar')

def welch(x):
    return 1.0 - x**2
plt.plot(x, [welch(xx) for xx in x], label='Welch')

def cosw(x):
    return cos(x * pi / 2.0)
plt.plot(x, [cosw(xx) for xx in x], label='Cos')

def lanczos(x):
    if x == 0.: return 1.0
    return sin(x * pi) / (x * pi)
plt.plot(x, [lanczos(xx) for xx in x], label='Lanczos')

def hamming(x):
    return 0.54 + 0.46 * cos(x * pi)
plt.plot([-1] + list(x) + [1], [0] + [hamming(xx) for xx in x] + [0],
         label='Hamming')

def hann(x):
    return 0.5 + 0.5 * cos(x * pi)
plt.plot(x, [hann(xx) for xx in x], label='Hann')

def blackman(x):
    alpha = 0.16
    return (1-alpha) / 2.0 + 0.5 * cos(x*pi) + alpha / 2.0 * cos(x*2*pi)
plt.plot(x, [blackman(xx) for xx in x], label='Blackman')

def bartlett(x):
    return 1.0 - fabs(x)
plt.plot(x, [bartlett(xx) for xx in x], label='Bartlett')

plt.legend(loc='lower center',
           borderaxespad=0.5, labelspacing=0.3, handletextpad=0.4)
plt.savefig(name)
mplwp.postprocess(name)

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

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

Date/TimeThumbnailDimensionsUserComment
current17:31, 1 October 2017Thumbnail for version as of 17:31, 1 October 2017600 × 400 (51 KB)Geek3 (talk | contribs)User created page with UploadWizard

The following page uses this file:

File usage on other wikis

The following other wikis use this file:

Metadata