Clear Filters
Clear Filters

Why does Simulink step response simulation not match step function output from MATLAB?

18 views (last 30 days)
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
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);
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
Both systems stabilze at the same amplitude, and the settling time improved greatly.
However, when using Simulink:
I get the following output (for a step input of 5):
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?

Answers (1)

Les Beckham
Les Beckham on 31 Oct 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 Comments
RÓMULO PRIETO
RÓMULO PRIETO on 1 Nov 2023
Thank you, I always thought that the amplitude had to be 1 for step response plot, I didn´t understand why it was some other number like 0.5 or in this specific case, 0.62. Nice
Les Beckham
Les Beckham on 2 Nov 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.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!