📜  伪随机输入信号 python 代码示例

📅  最后修改于: 2022-03-11 14:45:10.442000             🧑  作者: Mango

代码示例1
import numpy as np
import matplotlib.pyplot as plt

nstep = 300

# random signal generation

a_range = [0,2]
a = np.random.rand(nstep) * (a_range[1]-a_range[0]) + a_range[0] # range for amplitude

b_range = [2, 10]
b = np.random.rand(nstep) *(b_range[1]-b_range[0]) + b_range[0] # range for frequency
b = np.round(b)
b = b.astype(int)

b[0] = 0

for i in range(1,np.size(b)):
    b[i] = b[i-1]+b[i]

# Random Signal
i=0
random_signal = np.zeros(nstep)
while b[i]