# Discrepancy between MATLAB and Simulink closed loop response?

I have a closed loop system which I am testing in MALTAB and Simulink, expecting the same output.

MATLAB

num_plant = [0.0001 10];
den_plant = [0.005 5 0.6616 61.01 2.11 20];
G1 = tf(num_plant, den_plant)

num_controller = [46615 6526 5.722e05 2.389e04 2.001e05]
den_controller = [1 404 41605 162000 200000]

C2 = tf(num_controller, den_controller)
G2=G1*C2; %G1 is same 5th order TF as Simulink
new2 = feedback(G2, 1);
step(new2)


Note:

G1 =

0.0001 s + 10
--------------------------------------------------------
0.005 s^5 + 5 s^4 + 0.6616 s^3 + 61.01 s^2 + 2.11 s + 20

C2 =

46615 s^4 + 6526 s^3 + 572200 s^2 + 23890 s + 200100
----------------------------------------------------
s^4 + 404 s^3 + 41605 s^2 + 162000 s + 200000


According to the official documentation, feedback should be doing what I am presenting with blocks in Simulink. Surely I am missing something. I checked the code and everything should be the same in both cases. What is the reason for this discrepancy?

>> which step -all
C:\Program Files\MATLAB\R2018a\toolbox\control\ctrlobsolete\step.m
C:\Program Files\MATLAB\R2018a\toolbox\shared\controllib\engine\@DynamicSystem\step.m  % DynamicSystem method
C:\Program Files\MATLAB\R2018a\toolbox\ident\ident\@iddata\step.m                      % iddata method
C:\Program Files\MATLAB\R2018a\toolbox\matlab\system\@system\step.m                    % system method


Anything suspicious?

• I can't believe I missed that! Thanks for you contribution, you are right. I updated the question... Still, however, the graphs don't look identical to me. Could there be something else which I'm missing? – rrz0 Jan 7 '19 at 22:03

I would say you are doing something wrong in using matlab

num_plant = [0.0001 10];
den_plant = [0.005 5 0.6616 61.01 2.11 20];
G1 = tf(num_plant, den_plant)

num_controller = [46615 6526 5.722e05 2.389e04 2.001e05]
den_controller = [1 404 41605 162000 200000]

C2 = tf(num_controller, den_controller)
G2=G1*C2; %G1 is same 5th order TF as Simulink
new2 = feedback(G2, 1);
step(new2,50)
grid


This produces: