What I have done
I have written a code in Mathematica from scratch for simulating quadratic cost standard MPC problems for constant reference tracking.
YALMIP's website has a solved standard MPC example which should be reliable but it has a linear cost, which requires quite different functions and a different code (some parts are same as in quadratic case but some are different) to simulate and thus it does not validate my original code for quadratic costs.
I have tried to validate my code against a number of solved examples in research papers and lecture notes but the outcome is a mixed bag. For some my results match perfectly, for some the results for piece-wise constant reference tracking match only for some constant references (and an attempt to track the other references yields the error that there are no points that satisfy the constraints) and for some I get the error that there are no points that satisfy the constraints.
I am in a fix here. For each case above, I have tried at least two sources. I have found an outright mistake in one of the sources, a research paper, and this makes it difficult to know if any other source can be relied on or not.