title: How to use rate limiter with square signal and variable step size in Simulink?
body: <p>How to use rate limiter with square signal and variable step size in Simulink?</p>
  
  <p>Here's a screenshot of the model I'd like to set up:</p>
  
  <p><a href="http://www.mathworks.fr/matlabcentral/answers/uploaded_files/16347/rate_limiter_1.png" rel="nofollow noreferrer">model</a>:
  <img src="https://i.stack.imgur.com/7VRUu.png" alt="enter image description here"></p>
  
  <p>I feed a customized rectangular signal to a rate limiter to avoid vertical slopes.</p>
  
  <p>Unfortunately that doesn't seem to work. I'm using <strong>ode15s</strong>, it's a requirement. Here's the error message Simulink throws:</p>
  
  <blockquote>
    <p>Error: Input signals to Rate Limiter '.../Rate Limiter' are neither
    discrete nor continuous sample time signals. Only discrete or
    continuous input signals are supported</p>
  </blockquote>
  
  <p>Quite surprisingly I found a workaroud by adding an integrator directly followed by a derivative. This works:</p>
  
  <p><a href="http://www.mathworks.fr/matlabcentral/answers/uploaded_files/16346/rate_limiter_2.png" rel="nofollow noreferrer">workaroud</a>:</p>
  
  <p><img src="https://i.stack.imgur.com/j4tOc.png" alt="enter image description here"></p>
  
  <p>But it's ugly and I'm getting some very annoying stability issues in some cases. And I doubt very much that it is considered "good practice".</p>
  
  <p>So how is one supposed to use this rate limiter block in such a situation?</p>
  
  <p>John</p>