PID controller for part of code in for loop.
Show older comments
I'm creating a simulator which solves equations step by step in for loop and also plots the results afterwards. Part of code will require PID controller (later fuzzfied). One iteration of for loop simulates one second. How can I implement controller to receive a singal u [-1,1] and values every iteration with PID and control system toolbox? Signal 'u' is needed in one of equations in the loop of course. If i make schematic in simulink then it will be simulated instantly in one iteration and same every other, but I want it to provide a little delay. Code looks basically like this but i can attach it later if needed.
for dt=1:tsim
%lots of equations
%PID controller
%equations using signal of controller and values every iteration
%other equations
end
plotting;
Maybe there is a block in simulink which can help with it?
Answers (0)
Categories
Find more on PID Controller Tuning in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!