S={{s11,s12},{0,s22}};
SI=Inverse[S];
LQLT={{0,0},{0,10}};
F={{0,1},{-(w^2),-2 z w}};
allTerms=SI . F.S+Transpose[S].Transpose[F].Transpose[SI]+SI.LQLT.Transpose[SI];
Simplify[allTerms]

(* make sure that we have a symmetric matrix *)
allTerms[[2,1]]-allTerms[[1,2]]//Simplify

(* extract the matrix M_UT (note that we divide by 2 for the diagonals) *)
MUT={{allTerms[[1,1]]/2,allTerms[[1,2]]},{allTerms[[1,2]],allTerms[[2,2]]/2}};
MatrixForm[MUT]

(* multiply this by S on the left *)
SMUT=S.MUT

Convert these into expressions we can evaluate in Matlab

CForm[SMUT[[1,1]]]

CForm[SMUT[[1,2]]]

CForm[SMUT[[2,2]]]

(* part (a) the additional term to add... we again multiply the diagonal terms by 1/2 *)
HTRIH ={{0,0},{0,1}};
wprod=-S.Transpose[S].HTRIH.S;
MatrixForm[wprod]

CForm[wprod[[1,2]]]

CForm[(1/2)wprod[[2,2]]]

(* part (b) the additional term to add *)
HTRIH ={{1,0},{0,0}};
wprod=-S.Transpose[S].HTRIH.S//Simplify;
MatrixForm[wprod]

CForm[(1/2)wprod[[1,1]]]

CForm[wprod[[1,2]]]

CForm[(1/2)wprod[[2,2]]]

(* part (c) the additional term to add *)
HTRIH ={{1,0},{0,1}};
wprod=-S.Transpose[S].HTRIH.S//Simplify;
MatrixForm[wprod]

CForm[(1/2)wprod[[1,1]]]

CForm[wprod[[1,2]]]

CForm[(1/2)wprod[[2,2]]]