Gauss-Markov process in python: how to filter properly a white noise sequence

Viewed 34

I'm pretty new in Python. I would like to sintetize a first order Gauss-Markov process from a white Gaussian noise. I know from signal processing theory that it could be performed using a noise shaping filter designed properly. See https://en.wikipedia.org/wiki/Gauss%E2%80%93Markov_process for details. First order Guass-Markov processes have two parameter: sigma, which is the standard deviation of the process, and the time costant beta.

The shaping filter should have a transfer function equal to the one in this figure:

enter image description here

Here it is my code:

import scipy.signal as dsp
import numpy as np

Nsamples = 2000
fs = 100

time = np.arange(Nsamples) / fs

rng = np.random.default_rng()
gaussianNoise = rng.standard_normal(size=time.shape)

wgn = (gaussianNoise - np.mean(gaussianNoise)) / np.std(gaussianNoise)
print('\n\n\nWGN MEAN: ', np.mean(wgn))
print('WGN STD: ', np.std(wgn))


beta = 0.01
sigma = 0.1
b = np.array([np.sqrt(2 * beta * sigma**2)])
a = np.array([1, beta])

gaussMarkovNoise = dsp.lfilter(b, a, whiteGaussianNoise)

Unfortunately, something is wrong because the gaussMarkovNoise should have an autocorrelation with an exponential decay (see http above); while filtered in this way, it still has a spike in the origin as a white noise sequence. What am I missing?

0 Answers
Related