I've written down a discrete state-space model for a simple pendulum, with the state variables angle, angular velocity and angular acceleration.
This can be easily plugged into a simple Kalman filter to estimate the state. However, if the length l
of the string was constant but unknown, is there any way of using a Kalman filter to estimate l
alongside of the rest of the state?
I can't figure out how to linearise the term angle / l
. Would an EKF help here?
g = 9.81;
l = 3;
dt = 30e-3; % 30 ms
A = [ 1 dt 0; % angle_{k+1} = angle_k + dt * ang_vel_k
0 1 dt; % ang_vel_{k+1} = ang_vel_k + dt * ang_acc_k
-g/l 0 0 ]; % ang_acc_{k+1} = -g/l * angle_k
B = [ 5/360*2*pi*dt; 0; 0];
C = [ 1 0 0 ];
D = 0;
sys = ss(A,B,C,D,dt);