Assuming you have already designed the PID controller in MATLAB, you can use the pid
and feedback
functions to simulate the response of the closed-loop system.
First, define the plant transfer function, set-point, and time duration of simulation:
main.m126 chars4 lines
Next, create the closed-loop system by combining the plant transfer function and the PID controller:
main.m75 chars6 lines
Finally, simulate the response of the system to a set-point change using the step
function:
main.m25 chars2 lines
This should give you the step response of the closed-loop system with the PID controller included. The output of the function is the response of the system to the set-point change.
gistlibby LogSnag