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?

  • 2
    $\begingroup$ you should magnitude-square the differences: e = (abs(h_e1 - h_true(1)).^2) + (abs(h_e2 - h_true(2)).^2) + (abs(h_e3 - h_true(3)).^2); if you're doing this in a lower level language, then $$ |z|^2 = \Re\{z\}^2 + \Im\{z\}^2 $$ and the square root operation needed for the abs() function can be skipped. $\endgroup$ Nov 24, 2016 at 23:00

1 Answer 1


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:


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));
  • $\begingroup$ Thank you for the ansawer. I have a related question would you please help? The channel coefficients are modelled as L = 3; H = (randn(L, 1) + 1j*randn(L,1))/sqrt(2); and my input data $x$ also has real and imaginary part. The received data is $z = filter(H,1, y)$ where $y = x + w$ where w is additive white complex noise $~ N(0,\sigma^2_w)$. I am using Uscented Kalman filter for estimating the channel coefficients. Would I do the estimation separately for real and imaginary part? $\endgroup$
    – SKM
    Nov 25, 2016 at 0:14
  • $\begingroup$ I am confused because if I do the estimation using both real and imaginary then what would be the covariance matrix $P$ -- would it contain real and imag? What is the correct way to do estimation and implementation of it. Thank you very much for your help $\endgroup$
    – SKM
    Nov 25, 2016 at 0:15
  • $\begingroup$ Should I do filtering/ processing with separated real/imag data rather then complex if the underling data is complex? Filtering separately is easier as I don't have to modify the underlying equations and the matlab implementations avaliable but I wonder if this is theoretically correct or not. $\endgroup$
    – SKM
    Nov 25, 2016 at 0:27
  • $\begingroup$ @SKM You are posing several questions and I am afraid It cannot be handled in the comments, why not asking a separate question? Explain the situation in details and I will try to answer if I have relevant information. $\endgroup$
    – msm
    Nov 25, 2016 at 0:34
  • $\begingroup$ @robertbristow-johnson It wasn't the main point! The idea was to do it the right way, which is the vector way... $\endgroup$
    – msm
    Nov 25, 2016 at 2:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.