Clear Filters
Clear Filters

Discrepancy between MATLAB and Simulink closed loop response?

1 view (last 30 days)
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
2.png
**SIMULINK**
1.png
----------
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?
  2 Comments
Aquatris
Aquatris on 7 Jan 2019
What version of Matlab are you using?
I used the script (coppied your code without change other than adding grid on) in Matlab 2013a and the result looks identical to your simulink results.
untitled.jpg
Ryan Rizzo
Ryan Rizzo on 7 Jan 2019
Thanks for trying this out! I am using MATLAB R2018a. I cannot understand why our results differ so much! Any suggestions on what I should do? Could it be that I'm using a different solver or something of the sort?

Sign in to comment.

Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!