Is "ss" not acceptable in Simulink?

26 views (last 30 days)
Tao Lu
Tao Lu on 6 Dec 2015
Answered: Walter Roberson on 6 Dec 2015
Dear all:
In my simulink, I have a controller which relies on the discrete Ad, Bd, Cd, Dd matrix of a continuous state-space. The continuous state-space matrix Ac, Bc, Cc, Dc are changing for every time step depending on the system states and inputs, which means Ad, Bd, Cd, and Dd are changing with each time step too. In simulink, I use the Matlab fcn, but when running, it shows error:
The 'ss' class does not support code generation.
Function 'MATLAB Function' (#35.1334.1351), line 109, column 33: "ss(Ac,Bc,Cc,Dc)" Launch diagnostic report.
Can anyone help me with this? Thank you.

Answers (1)

Walter Roberson
Walter Roberson on 6 Dec 2015
You would get that when you use ss() if you attempted to use Rapid Acceleration mode or tried to generate code for a target.
The MATLAB Function block is primarily for blocks of code that can have code generated in order to run more quickly. If you are using a MATLAB Function block because you just want to call into MATLAB routines, then the Interpreted MATLAB block would be more appropriate.
If you do need Rapid Acceleration mode or need to generate code for a target, you will need to change the way you control the device in your release.
Note that current versions of the Model Predictive Control toolbox appear to allow ss to be used for code generation; see http://www.mathworks.com/help/mpc/ug/code-generation-with-simulink-coder.html

Community Treasure Hunt

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

Start Hunting!