The following code (see 1st 2 images attached) is used to produce PID controller values that are designed to control the system (G). The code finds the PID controller values (noted as k) by using reinforcement learning with a genetic algorithm.
The problem I have is that there is an inherent offset of approximately 0.05v which is undesirable (see image 3). How can I correct the system so that the offset does not occur?
I think the steady state error is caused by line 8 of the second image (pidtest.m) but I am not sure if I can force Matlab to be more accurate in its resultant output.
The system of which it produces in line 8 contains the offset of 4.95v I think