Problem about code generation with Matlab function

In a matlab function,I tried to convert a continuous state space model to a discrete one:
Ts=0.005;
Ad=(eye(22)+Ap*Ts/2.0)*inv(eye(22)-Ap*Ts/2.0);
Bd=inv(eye(22)-Ap*Ts/2.0)*Bp*sqrt(Ts);
Cd=sqrt(Ts)*Cp*inv(eye(22)-Ap*Ts/2.0);
Dd=Dp+Cp*inv(eye(22)-Ap*Ts/2.0)*Bp*Ts/2.0;
but when code generation with grt.tlc, the problem report as following:
CGIR assertion 'StaticMatrixType::isa(aExpr->type()) == StaticMatrixType::isa(aExpr->rhs()->type())
log: ./cg_insanity_23.html' failed in '.\dom_core\utility\cg_sanity_checker.cpp:1317'
[ 0] 0x66521200 D:/Program Files/MATLAB/R2011a/bin/win32/cgir_xform.dll+00332288 ( CG::SanityChecker::assertError+000048 )
[ 1] 0x6652214f D:/Program Files/MATLAB/R2011a/bin/win32/cgir_xform.dll+00336207 ( CG::SanityChecker::sanityCheckAssign+000127 )
[ 2] 0x6652038d D:/Program Files/MATLAB/R2011a/bin/win32/cgir_xform.dll+00328589 ( CG::SanityChecker::doNodeSwitch+000157 )
[ 3] 0x66520804 D:/Program Files/MATLAB/R2011a/bin/win32/cgir_xform.dll+00329732 ( CG::SanityChecker::doNode+000148 )
[ 4] 0x66520765 D:/Program Files/MATLAB/R2011a/bin/win32/cgir_xform.dll+00329573 ( CG::SanityChecker::doExpr+000053 )
[ 5] 0x665207ea D:/Program Files/MATLAB/R2011a/bin/win32/cgir_xform.dll+00329706 ( CG::SanityChecker::doNode+000122 )
[ 6] 0x6652083f D:/Program Files/MATLAB/R2011a/bin/win32/cgir_xform.dll+00329791 ( CG::SanityChecker::doStmt+000047 )
[ 7] 0x66523423 D:/Program Files/MATLAB/R2011a/bin/win32/cgir_xform.dll+00341027 ( CG::SanityChecker::doStmts+000051 )
[ 8] 0x665208bb D:/Program Files/MATLAB/R2011a/bin/win32/cgir_xform.dll+00329915 ( CG::SanityChecker::doFcn+000107 )
[ 9] 0x6652096a D:/Program Files/MATLAB/R2011a/bin/win32/cgir_xform.dll+00330090 ( CG::SanityChecker::doModule+000106 )
[ 10] 0x665209ff D:/Program Files/MATLAB/R2011a/bin/win32/cgir_xform.dll+00330239 ( CG::sanityCheckModule+000063 )
[ 11] 0x669b648c D:/Program Files/MATLAB/R2011a/bin/win32/rtwcg.dll+00681100 ( RTWCG::RTWFcnConst::OptimizeAndEmitCode+001676 )
[ 12] 0x66978901 D:/Program Files/MATLAB/R2011a/bin/win32/rtwcg.dll+00428289 ( RTWCG::RTWCGModule::OptimizeAndEmitCode+000161 )
[ 13] 0x66f1668d D:/Program Files/MATLAB/R2011a/bin/win32/libmwsimulink.dll+02188941 ( BlockSetCheckVarDimsInputEmpty+066765 )
[ 14] 0x66f1360e D:/Program Files/MATLAB/R2011a/bin/win32/libmwsimulink.dll+02176526 ( BlockSetCheckVarDimsInputEmpty+054350 )
[ 15] 0x66f67776 D:/Program Files/MATLAB/R2011a/bin/win32/libmwsimulink.dll+02520950 ( SlCosSFunc::operator=+002854 )
### Build procedure for model: 'SIMO_AdaptiveCtrl' aborted due to an error.

1 Comment

I wonder... if you were to comment out statements starting from the end, can you pin this down to one statement?

Sign in to comment.

Answers (1)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products

Asked:

xu
on 14 Dec 2012

Answered:

on 10 Jan 2018

Community Treasure Hunt

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

Start Hunting!