Question About $ Q $ Matrix (Model Process Covariance) in Kalman Filter
I'm the author of the textbook linked to above. This is a new account and thus I am not allowed to reply to that answer.

Anyway, the Gaussian chapter covers the definition of a covariance matrix. In general though your Q matrix will be full, not a diagonal, because there is correlation between the state variables. For example, suppose you are tracking position and velocity in x-axis for a car. Process noise (which Q is modelling) might be things like wind, bumps in the road, and so on. If there is a change in velocity due to this noise, there will also be a change in position. They are correlated, and so the off-diagonal elements will be non-zero for those terms.

The Kalman math chapter tells you how to compute the Q matrix for various scenarios. Admittedly there is more work to be done on that section. It's one of the more opaque subjects as most sources either gloss over it or just throw an integral at you and expect you to figure out the rest.

Finally, the companion FilterPy project contains code to compute the full Q matrix for you given common scenarios. The code is in common/discretization. For analytically difficult situations there is a routine to find the result numerically following an idea from Golub and Van Loan; the textbook is lacking on this topic, however.