break demo_matrixreg.m into more blocks for better readability