Closed shenjianaixuexi closed 4 years ago
The A matrix should be given by you in the filter constructor parameter state_transition
. The Kalmain gains can obtained by using the general function compute
. Both the smoothing and filtering gains are available. This was not documented very clearly, I'll have to fix that at some point. Here's an example
import numpy as np
import simdkalman
import pandas as pd
import matplotlib.pyplot as plt
np.random.seed(0)
data = np.random.normal(size=50)
kf = simdkalman.KalmanFilter(
state_transition = [[1,1],[0,1]], # <--- this is the matrix A
process_noise = np.diag([0.05, 0.002]), # Q
observation_model = np.array([[1,0]]), # H
observation_noise = 20.0)
result = kf.compute(data, 0, filtered=True, smoothed=True, gains=True)
t = range(data.size)
plt.plot(t, data, 'kx', alpha=0.2)
plt.plot(t, result.filtered.observations.mean, 'b-')
plt.show()
# filtering gains
print(result.filtered.gains)
# smoothing gains
print(result.smoothed.gains)
thanks for your help. I will try it right now.
I want to get A MATRIX and kalman gains ,what should i do?