This feature has been implemented in Simulink 6.0 (R14) via the Rate Limiter Dynamic block. If you are using a previous version, read the following:
The ability to use the Rate Limiter block to allow variable rising and falling slew rates is not available in Simulink.
To work around this issue, try writing a MATLAB file S-function that uses the SET_PARAM command to change the rising and falling slew rates. For a sample model and MATLAB file S-function that illustrates how to change the parameter of one block using the output value of another, see the related solutions section at the bottom of this page.
For example, you may use a command such as
to set the rising slew rate to the first input value to your MATLAB file S-function and use the following code
to set the falling slew rate to the second input value.
NOTE: 'fullblockname' refers to the full name of the Rate Limiter block that you are trying to change.
You may also find the following URLs helpful:
Programmatic Modeling basics:
MATLAB file S-functions:
Keep in mind that MATLAB file S-functions cannot be used with Real-Time Workshop, only C-MEX S-functions. An additional limitation of using S-functions with Real-Time Workshop is that C-MEX S-functions cannot call any MATLAB functions. For other guidelines for writing S-functions for use with Real-Time Workshop, see the related solutions section at the bottom of this page.
For real time applications, write your own version of the block as a C-MEX S-function. You will then be able to compile your block for use in Real-Time Workshop. As a guideline, use the algorithms given in the documentation for the Rate Limiter block, found at the following URL:
If you already have installed the help documentation for your licensed product(s), you may access the same page locally by typing the following at the MATLAB prompt:
For more information about creating a C-MEX S-function, see Chapter 3 of the Writing S-functions User's Guide. A PDF version of this guide can be found at the following URL respectively: