Xhat is estimated states, which KF estimates with given measurements. For KF block, input is innovation/residual sequence and produces some estimated states of a dynamical system on which KF is based.
Dear Mamoona Khalid : this is an example to understand better
""Example 2, Predict the position and velocity of a moving mobile,
The mobile is initially located at the point x = 0 and moves along the X axis with velocity varying around a constant speed 10m/sec. The motion can be described by a set of differential equations:
$$ \dot{x}_1 = x_2, x_1(0)=0$$
$$ \dot{x}_2 = w, x_2(0)=10, w \sim N(0,0.3^2)$$
where x_1 is the position and x_2 is the velocity, w the process noise due to road conditions, wind etc.
Problem: using the position measurement to estimate actual velocity.
Approach: We measure (sample) the position of the mobile every dt = 0.1 seconds. But, because of imperfect apparature, weather etc., our measurements are noisy, so the instantaneous velocity, derived from 2 consecutive position measurements (remember, we measure only position) is innacurate. We will use Kalman filter as we need an accurate and smooth estimate for the velocity in order to predict mobile's position in the future.
Model: The state space equation after discretization with sampling time dt
legend('Estimated velocity by raw consecutive samples','Estimated velocity by running average','True velocity','Estimated velocity by Kalman filter','Location','NorthWest');