File:Mu-law function.svg

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

Original file(SVG file, nominally 900 × 720 pixels, file size: 26 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description
English: Plot of mu-law function
Date
Source Own work
Author Morn
SVG development
InfoField
W3C grn 
The SVG code is valid.
Created with Matplotlib-logo 
This plot was created with Matplotlib.
Source code
InfoField

Python code

Source code
from pylab import *

def sgn(v):
    if v >= 0:
        return 1
    else:
        return -1

def fi(y):
    "Inverse mu-law"
    return sgn(y) * (256**(abs(y)) - 1) / 255

def ff(x):
    "Forward mu-law"
    return sgn(x) * log(1 + 255 * abs(x)) / log(256)

figure(figsize = (10, 8))
X = arange(-1, 1.01, .01)
Y = [fi(y) for y in X]
plot(X, Y)
xlabel("y")
ylabel("F⁻¹(y)")
title ("Inverse μ-law function")
axis((-1, 1, -1, 1))
grid()
savefig("mu-law-inv.svg")

figure(figsize = (10, 8))
Y = [ff(x) for x in X]
plot(X, Y)
xlabel("x")
ylabel("F(x)")
title ("μ-law function")
axis((-1, 1, -1, 1))
grid()
savefig("mu-law.svg")

show()

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
current14:54, 2 May 2022Thumbnail for version as of 14:54, 2 May 2022900 × 720 (26 KB)Morn (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file:

Metadata