Algorithm
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| kalman1_init | 1 | Initializes the 1-dimensional Kalman filter state structure |
| kalman1_filter | 1 | Performs 1-dimensional Kalman filtering |
| kalman2_init | 1 | Initializes the 2-dimensional Kalman filter state structure |
| kalman2_filter | 1 | Performs 2-dimensional Kalman filtering |
03 Members
Initializes the 1-dimensional Kalman filter state structure
Default configuration:
- State transition matrix (A) = 1.0
- Observation matrix (H) = 1.0
- Process noise covariance (q) = 200.0
- Measurement noise covariance (r) = 500.0
Note: These parameters should be tuned for specific applications
| Name | Type | Description |
|---|---|---|
state | kalman1_state | The Kalman filter state structure to initialize |
init_x | Single | Initial state value (x0) |
init_p | Single | Initial error covariance estimate (p0) |
Single)Performs 1-dimensional Kalman filtering
Implements standard Kalman filter equations:
- Prediction step (state and covariance)
- Measurement update (Kalman gain, state correction, covariance update)
| Name | Type | Description |
|---|---|---|
state | kalman1_state | Kalman filter state structure |
z_measure | Single | Measurement value |
Filtered state estimate
Initializes the 2-dimensional Kalman filter state structure
Default configuration:
- State transition matrix (A) = [[1, 0.1], [0, 1]]
- Observation matrix (H) = [1, 0]
- Process noise covariance (q) = [1e-6, 1e-6]
- Measurement noise covariance (r) = 1e-6
Note: These parameters should be tuned for specific applications
| Name | Type | Description |
|---|---|---|
state | kalman2_state | The Kalman filter state structure to initialize |
init_x | Single() | Initial state vector [x0, x1] |
init_p | Single()() | Initial error covariance matrix (2x2) |
Single)Performs 2-dimensional Kalman filtering
Updates both state vector elements (typically [position, velocity] or [angle, angular velocity]) and covariance matrix. Implements:
- State prediction
- Covariance prediction
- Kalman gain calculation
- State correction
- Covariance update
Returns the first element of the updated state vector (x[0])
| Name | Type | Description |
|---|---|---|
state | kalman2_state | Kalman filter state structure |
z_measure | Single | Measurement value |
Primary state estimate (x[0])