一、示例图
类型 | 形状 | 来源 |
脉冲误差 (Pulse error) | | |
阶跃误差 (Step error) | | |
渐变误差 (Slow Growing Error) | | |
常值偏差 (Constant Bias) | | |
白噪声 (While noise) | | |
随机游走噪声 (Random walk noise) | | |
二、代码
import numpy as np
from matplotlib import pyplot as plt
np.random.seed(6)
def random_walk():
steps = np.random.standard_normal(size=500)
steps[0] = 0
walk = np.cumsum(steps)
return walk
def step_function(x):
return np.array(x>0,dtype=np.int)
def rect_wave(x,c,c0): #起点为c0,宽度为c的矩形波
if x>=(c+c0):
r=0.0
elif x<c0:
r=0.0
else:
r=1
return r
white_noise = np.random.standard_normal(size=500)
plt.figure(figsize=(2, 3))
plt.plot(white_noise)
plt.figure(figsize=(2, 3))
plt.plot(random_walk())
plt.figure(figsize=(2, 3))
x = [1,2,3]
y = [0,5,0]
plt.stem(x,y)
plt.figure(figsize=(2, 3))
x=np.linspace(-2,4,1000)
y=np.array([rect_wave(t,2.0,-1.0) for t in x])
plt.ylim(-0.2,1.2)
plt.plot(x,y)
plt.figure(figsize=(2,3), dpi=80)
plt.plot([1,2,3], [4,5,6])
plt.figure(figsize=(2,3), dpi=80)
plt.plot([1,2,3], [4,4,4])
plt.show()
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)