Why does Simulink step response simulation not match step function output from MATLAB?
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Les Beckham
el 31 de Oct. de 2023
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 comentarios
Les Beckham
el 2 de Nov. de 2023
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.
Ver también
Categorías
Más información sobre Classical Control Design en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!