# How to determine covariance matrices $\mathbf P$, $\mathbf Q$, and $\mathbf R$ in Extended Kalman Filter

I am implementing an Extended Kalman-Filter and an Unscented Kalman-Filter for state and parameter estimation of a conveyer belt system. The problem is that I don't really know how to determine the process-covariance $$\mathbf Q$$, the measurement-covariance $$\mathbf R$$ and the error-covariance $$\mathbf P$$. I would like to determine them before the simulation started just with two measurements given.

Do you know how I can do it or do you know of a paper or book which could explain how to do it to me ?

For a Kalman filter -- either extended or plain old, you compute the state covariance ($$\mathbf P$$) at each iteration of the filter.
Your task is to take the problem, turn it into a problem statement in math that includes the $$\mathbf Q$$ and $$\mathbf R$$ matrices (either as constants, or as functions of time and/or the state), and the starting value of $$\mathbf P$$.
Do this correctly, and subsequent values of $$\mathbf P$$ will be taken care of by the filter.