我想使用以下代码绘制正态函数与对数正态函数:
from scipy.stats import norm, lognorm
import numpy as np
import matplotlib.pyplot as plt
# example: r(t) = ln(1 + R(t)) ~ N(0.05, (0.5)^2))
# 1 + R(t) = exp(r(t)) ~ logNormal(0.05, (0.5)^2)
# R(t) = e(r(t)) - 1 ~ logNormal(0.05, (0.5)^2) - 1
#
# plot normal and log normal density
mu = .05
sd = .5
x = np.linspace(mu - 3 * sd, mu + 3 * sd, 100)
plt.plot(x, norm.pdf(x, mu, sd), label="Normal")
plt.plot(exp(x)-1, lognorm.pdf(exp(x), mu, sd), '--', label="Log-Normal")
怎么了 ?我期待类似的东西: