The problem was a result from the InitializeCondition(block). I have used a InputPort to get starting data and this regarding to http://www.mathworks.com/help/releases/R2017b/simulink/sfg/initializeconditions.html should no be used in that section. Therefor a variable becomes Zero and lead to a complex number for M.
Just to close this question