Note: The design is implemented in Simulink.

Suppose I have a system wherein I am computing the sum of errors per discrete time interval. Now, I only want to consider positive errors to be summed up every time. How can I reject negative errors?

Here are some of my failed solutions just so you know:

  1. I tried to connect the error output to an "if block" in the ports and subsytem. The output of the "if block" is connected to the discrete time integrator to sum up the positive errors then to scope

**This fails because the "if block" limits its output port connection to be not a subsystem.

  1. I tried to connect the error output to the relational operator. When the output is less than 0, then the output of the relational operator is 1 otherwise 0. The output of the relational operator is connected to a gain of (50), since luckily, the error is either 50 or -50. Then the gain is connected to discrete time integrator then to scope.

**This also fails since the readings in the scope only lies between 0 to 1, which is entirely impossible since it should be a multiple of 50.


You can use the saturation block. Set the upper limit to "Inf" (thanks @Petrus1904) and the lower limit to 0.

The output of the saturation block should accordingly be only the positive values of whatever input you gave it.

  • 2
    $\begingroup$ Since "Inf" is a value in Matlab, I even think setting the upper limit to "Inf" is possible. $\endgroup$
    – Petrus1904
    Sep 2 at 14:47
  • $\begingroup$ I just tried it, you are correct, Inf works as upper limit. $\endgroup$ Sep 2 at 14:49
  • $\begingroup$ Unfortunately, there's none. The input (which is error) came from the subtraction block. $\endgroup$ Sep 2 at 14:50
  • $\begingroup$ @RobChristianCaduyac I updated my answer $\endgroup$ Sep 2 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.