File:VoigtPDF.svg
Summary
Description | |
Date | |
Source | Own work |
Author | Shiyu Ji |
Other versions |
|
SVG development | |
Source code | Python code# PDF of Voigt Distribution
import matplotlib.pyplot as pl
import numpy as np
from scipy.special import wofz
import matplotlib.patches as mpatches
from math import pi
t0 = -10.0
dt = 0.01
t_final = 10.0
T = np.arange(t0, t_final, dt)
ax = pl.figure().add_subplot(111)
def V(sigma, gamma, x):
z = (x + 1j * gamma) / (sigma * (2**0.5))
return wofz(z).real / (sigma * (2*pi)**0.5)
def pdf(ax, sigma, gamma, color):
for t in T:
old_value = V(sigma, gamma, t)
new_value = V(sigma, gamma, t+dt)
ax.plot([t, t+dt], [old_value, new_value], color, linewidth=1.0)
pdf(ax, 1.53, 0.00, 'k-')
pdf(ax, 1.30, 0.50, 'b-')
pdf(ax, 1.00, 1.00, 'g-')
pdf(ax, 0.01, 1.80, 'r-')
blackPatch = mpatches.Patch(color='black', label='$\sigma=1.53, \gamma=0.00$')
bluePatch = mpatches.Patch(color='blue', label='$\sigma=1.30, \gamma=0.50$')
greenPatch = mpatches.Patch(color='green', label='$\sigma=1.00, \gamma=1.00$')
redPatch = mpatches.Patch(color='red', label='$\sigma=0.01, \gamma=1.80$')
pl.legend(handles = [blackPatch, bluePatch, redPatch, greenPatch], loc=1)
pl.show()
|
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
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.