From 05f14e398fdf9c3d9248571ff4aaf8cdf1d4de04 Mon Sep 17 00:00:00 2001
From: Michel Juillard <michel.juillard@mjui.fr>
Date: Tue, 10 May 2011 10:45:25 +0200
Subject: [PATCH] correcting bug in forcing real values for complex elements of
 Jacobian in static model (cherry picked from commit
 fb68592592a75a79c692f0030046737818c62eec)

---
 preprocessor/StaticModel.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/preprocessor/StaticModel.cc b/preprocessor/StaticModel.cc
index 5d74d2d8fc..20a271943b 100644
--- a/preprocessor/StaticModel.cc
+++ b/preprocessor/StaticModel.cc
@@ -1193,7 +1193,7 @@ StaticModel::writeStaticMFile(const string &func_name) const
     }
 
   output << "  if ~isreal(g1)" << endl
-         << "    g1 = real(g1)+2*imag(g1);" << endl
+         << "    g1 = real(g1)+imag(g1).^2;" << endl
          << "  end" << endl
          << "end" << endl
          << "if nargout >= 3," << endl
-- 
GitLab