Let’s dive in.

% Update (correction) K = P*H'/(H*P*H' + R); % Kalman gain x = x + K*(measurements(k) - H*x); P = (eye(2) - K*H)*P;

By next week, you will be the person on the forum explaining the Kalman Gain to other beginners.