I understand you are not being able to calculate ‘Q’ in the above equation because ‘C’ is a singular matrix. You can use the ‘Moore-Penrose pseudoinverse’ for calculating the pseudo-inverse of singular matrices. In MATLAB, you can use the ‘pinv’ function to compute the pseudoinverse of a singular matrix. You can compute the aforementioned equation in the following way:
C_pinv = pinv(C)
Q = A – B*C_pinv*B';
You can refer to the MATLAB documentation to know about the Moore-Penrose pseudoinverse:
- pinv: to compute the Moore-Penrose pseudoinverse -https://www.mathworks.com/help/matlab/ref/pinv.html
- To know more about the Moore-Penrose pseudoinverse, refer
- https://www.mathworks.com/help/matlab/ref/pinv.html#mw_ffa95973-29a2-48a1-adb0-5a4214e0d9cf
Hope this answers your question.