The “Mean” Block in Simulink meets errors when the input is complex number

5 views (last 30 days)
As show in this model, the binary bit stream is modulated by 16-QAM, followed by the 8 up-sampling and AWGN module. In the scenario, the optimal receiver is calculating the average value of each 8 samples.
However, the model report error:
Unsigned integer or fixed-point signals must be real. (See the figure below)
By examining the setting of “Mean” block, I found that the relative setting of fixed-point is system default. In MATLAB Help system, it’s described that the mean of a complex input is computed independently for the real and imaginary components.(showed below)
Hence, I tried other method of calculating mean value of complex number, including the following 4 kinds(Screenshot is below):
  1. Calculate the real part and imaginary part of the complex number. The result showed that it’s right.
  2. I built the block calculating the mean value using the “Submatrix” module. The result showed that it’s right.
  3. Let the output of “Mean” block to Workspace. The result showed that it’s right.
  4. I write the m code calculating the mean value in “MATLAB Fun” block. The result showed that it’s right.
I find a strange phenomenon that the output of “Mean” block cannot connect to “Rectangular QAM Demodulator Baseband” block. Otherwise MATLAB will report error.
I have examined the data type and data dimension. It shows that there’s no problem.
My Operating System: Windows 7 with 64Bit.
MATLAB: R2015a
The right and wrong mdl modle file is attached in the last.

Accepted Answer

jibrahim
jibrahim on 4 Mar 2016
Hi Li,
This is a bug in the Mean block. A workaround is to insert a 'Complex to Real-Imag' block followed by a 'Real-Imag to Complex' block after the Mean block (see attached snapshot).
Thanks, Jihad
  3 Comments
jibrahim
jibrahim on 7 Mar 2016
Hi Li,
The bug will be fixed in R2016b. For R2016a, unfortunately you will have to use the workaround. Sorry about the inconvenience.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!