【GNSS】【Python】numpy模拟白噪声和随机游走

 

【GNSS】【Python】numpy模拟白噪声和随机游走_第1张图片

 

 

 

【GNSS】【Python】numpy模拟白噪声和随机游走_第2张图片

 

 

 

 

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline


n = 500
white_noise = np.random.standard_normal(size=n)
plt.plot(white_noise)
plt.title('White Noise')



random_walk = [0.0]
for i in range(n):
    old_total_noise = random_walk[i]
    new_noise = white_noise[i]
    random_walk.append(old_total_noise + new_noise)
random_walk = np.array(random_walk)

plt.plot(random_walk)
plt.title("Random Walk")

你可能感兴趣的:(【GNSS】【Python】numpy模拟白噪声和随机游走)