You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mci_linear_post.m
    path of file: ./repos/spm12/toolbox/mci/models/linear
    
    the code of the file until where you have to start completion: function [Ep,Cp,L] = mci_linear_post (M,U,Y)
% Analytic posterior for linear regression
% FORMAT [Ep,Cp,L] = mci_linear_post (M,U,Y)
% 
% M     Model Structure
% U     Inputs
% Y     Data
%
% Ep    Posterior mean
% Cp    Posterior covariance
% L     Log evidence
%__________________________________________________________________________
% Copyright (C) 2015 Wellcome Trust Centre for Neuroimaging

% Will Penny
% $Id: mci_linear_post.m 6548 2015-09-11 12:39:47Z will $

ipC=inv(M.pC);

    
function [Ep,Cp,L] = mci_linear_post (M,U,Y)
% Analytic posterior for linear regression
% FORMAT [Ep,Cp,L] = mci_linear_post (M,U,Y)
% 
% M     Model Structure
% U     Inputs
% Y     Data
%
% Ep    Posterior mean
% Cp    Posterior covariance
% L     Log evidence
%__________________________________________________________________________
% Copyright (C) 2015 Wellcome Trust Centre for Neuroimaging

% Will Penny
% $Id: mci_linear_post.m 6548 2015-09-11 12:39:47Z will $

ipC=inv(M.pC);
iCe=inv(M.Ce);
X=U.X;
iCp=X'*iCe*X+ipC;
Cp=inv(iCp);
Ep=Cp*(X'*iCe*Y+ipC*M.pE);

% Log evidence
yhat=X*Ep;
T=length(yhat);
if isstruct(Y)
    ey=Y.y-yhat;
else
    ey=Y-yhat;
end