Matlab: What is the proper way to calculate mean square error for complex numbers I am confused regarding the calculation of mean square error involving complex numbers. Considering, the true channel coefficients to be

h_true =

   0.7071 + 0.7071i
   0.4243 + 0.4243i
   0.2121 + 0.2121i


and the estimates to be

 h_e1 = 0.8100+0.8100i  
 h_e2 = 0.5100 + 0.5100i  
 h_e3 =  0.1200 +  0.1200i;


For training epoch 1, I calculated the error between the estimates and the actual  as 

e = ((h_e1 - h_true(1)).^2) + ((h_e2 - h_true(2)).^2) + ((h_e3 - h_true(3)).^2)   ;


Then the mean square error is

mse = e/3;


which gives zero for the real part and some small number for the imaginary part.

mse = 0 + 0.0176i


Should I be calculating the error separetely for iamginary and real part or is this okay?
The mean square error is

e = ((abs(h_e1 - h_true(1))^2) + (abs(h_e2 - h_true(2))^2) + (abs(h_e3 - h_true(3))^2))/3;


But it is tediuos! 

What if you had $1000$ terms instead of $3$? Do you want to add one by one?

Do it in the vector form for more clarity and ease of implementation:

$$\mathrm{mse}=\mathsf{E}(|\mathbf{h}-\hat{\mathbf{h}}|^2)$$

In MATLAB, you can use the function mse() 

 h_true = [ 0.7071 + 0.7071i
            0.4243 + 0.4243i
            0.2121 + 0.2121i ];

 h_e = [ 0.8100 + 0.8100i  
         0.5100 + 0.5100i  
         0.1200 + 0.1200i ];

 e = mean(abs(h_e-h_true).^2); % or eqivalently e = mse(abs(h_e-h_true));