I am researching a method to determine the optimal PID gains for a line follower robot. The problem is, I don't know how to setup the performance index IAE and ISE in the matlab. Any tips on how to do it?

My current progress are as follows:

  1. I have a copy of simulink based PID control of line follower mobile robot
  2. I have some optimization algorithms in mind (I can use it to compute for optimal PID gains)

Edit: Attached here is the picture of the simulink (credits to mobile robotics training for Matlab). Basically, the error here is computed using the subtract block from reference (2900) to measured (anything from 2850 to 2950 - measured by the sensor). Now my problem is on how to record the IAE and ISE before it reaches the end point of line follower.


  • $\begingroup$ The acronyms ISE & IAE seem to be integral square error and integral absolute error. There are formulae for computing these if you have the reference signal and output signal. Have you tried implementing these formulae in Simulink. Simulink provides integral block, square block, and absolute block. Where exactly are you stuck ? Please provide more details to explain where and why you are stuck. $\endgroup$
    – AJN
    Jul 14 at 13:13
  • $\begingroup$ Hi AJN, it is already edited. Thank you for the response btw $\endgroup$ Jul 15 at 13:26
  • $\begingroup$ Have you tried connecting error-->[pow.2]-->[1/s]-->[scope] to the error signal line? That should give a plot of integral square error versus time. The final value of that signal just when the follower reaches the end of the line is probably what you want. The scope can be replaced by a toworkspace block to export the signal to the matlab workspace for feeding your optimisation algorithm (if the optimisation is done in matlab and not in simulink) $\endgroup$
    – AJN
    Jul 15 at 13:31
  • $\begingroup$ Yeah, but the problem is I have discrete time consideration for PID block $\endgroup$ Jul 15 at 13:40
  • $\begingroup$ But the error signal is continuous time; right? So you can still compute ISE. In case the error signal is also discrete time, then replace the integrator with an accumulator which sums the successive values of the square error signal. $\endgroup$
    – AJN
    Jul 15 at 14:09

Your Answer

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

Browse other questions tagged or ask your own question.