Why does Simulink step response simulation not match step function output from MATLAB?
조회 수: 18 (최근 30일)
이전 댓글 표시
Hey guys, I am designing a digital controller for my second order plant, its continuous open loop transfer function is as follows:
T = 0.2;
nums = [0.7297];
dens = [1 0.2606 0.4378];
Gps = tf(nums, dens);
Gpz = c2d(Gps, T, 'ZOH'); % For plant discretization and controller design
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1525471/image.jpeg)
I am using a phase lead compensator, I arrive at the following controller discrete function:
Dz_lead = 10.2751*tf([1 -0.8196], [1 0.8541], T);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1525476/image.jpeg)
Plotting the step response of the controlled and uncontrolled systems (Gpz being the ZOH discretization mentiones before):
GDz_lead = Gpz*Dz_lead;
Cz = feedback(Gpz, 1);
Cz_lead = feedback(GDz_lead, 1);
step(Cz, 'r', Cz_lead, 'g', 50);
legend('Uncompensed system', 'Phase lead compensation');
grid on
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1525486/image.jpeg)
Both systems stabilze at the same amplitude, and the settling time improved greatly.
However, when using Simulink:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1525491/image.jpeg)
I get the following output (for a step input of 5):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1525496/image.jpeg)
Why does it fall short with respect to the input? The step function used previously says it shoud follow nicely, or do I need to add a proportional gain before the compensator every time?
댓글 수: 0
답변 (1개)
Les Beckham
2023년 10월 31일
It appears to have the same gain as your Matlab step response. The steady state response appears to be about 0.62 for a unit step input (which is what the step function uses), and 0.62 * 5 is 3.1 which is what it looks like you have in the Simulink scope output.
It looks to me like it is working just fine.
댓글 수: 2
Les Beckham
2023년 11월 2일
You are welcome.
Adding a controller to a system can definitely change the steady state gain of the closed loop system.
It is up to you when designing a controller to decide if you want the output/input gain to be unity or not.
If my answer (and comments) answered your question, please consider clicking Accept.
참고 항목
카테고리
Help Center 및 File Exchange에서 Classical Control Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!