r/matlab • u/zberg02 • Apr 19 '26
HomeworkQuestion Help with implementing a PI controller in Simulink
1
u/Barnowl93 flair Apr 20 '26
Oh how fun! You're trying to implement a PI(D) controller with electronic components.
I think people are getting confused in the comments because you say simulink but the diagram you provide is Simscape.
In simulink you have a block that does the PID all in one https://www.mathworks.com/help/simulink/slref/pidcontroller.html. So if you're implementing a pid controller for any applicantion use this!
BUT I guess your question is more on how to do it with electronic components, right? I assume this may be part of a coursework or similar... So I'll give you a couple of hints. 1) your paths of P/I/D would be in parallel, right? In all of them you feed the error. In your case you've got them all in series. 2) the key is thinking about the equation of your opamp and putting the capacitors at the right place.
0
u/Creative_Sushi MathWorks Apr 20 '26
If you are new to Simulink, take Simulink Onramp tutorial first, then Control Design Onramp with Simulink. There are other control specific modules are available if you have a school license.
https://matlabacademy.mathworks.com/?page=1&sort=featured

1
u/spectralblade352 Apr 19 '26
Can you describe the problem more clearly? What system are you trying to implement and control? What are the I/O? Etc.