Why I get different result at Simulink? (Matlab, Simulink)

8 ビュー (過去 30 日間)
Bob
Bob 2016 年 4 月 23 日
コメント済み: Stefan Raab 2016 年 4 月 23 日
Why I get different results? (Matlab, Simulink)
My problem is that I get different results with Matlab (Transfer Function) and Simulink at closed loop.
Amplitude is different and when I zoom at Simulink's Plot I get this odd irregularity.
Matlab:
Simulink:

採用された回答

Stefan Raab
Stefan Raab 2016 年 4 月 23 日
Hello,
I suppose that depends on the solver. The documentation of the "step" function describes in the "More About/Algorithms" section, that the sample time is chose automatically, fixed step if I remember correctly. In Simulink however, you might have used a variable step solver (probably ode45), which is more accurate generally. You can also execute the "step" function with a specified sample time, try a really small sample time as 1e-6 or 1e-7 as this should increase the accuracy. The command then would be:
t = 0:1e-6:10;
step(YourSYS,t);
For the documentation on the step function, execute the following command:
web(fullfile(docroot, 'control/ref/step.html'))
Does this yield more accurate results?
Kind regards, Stefan
  2 件のコメント
Bob
Bob 2016 年 4 月 23 日
Thanks for your answer,
This fixed my problem. Now my results is correct.
%%Simulink Model
t = 0:1e-6:10;
sim('Simulink_Model',t);
Stefan Raab
Stefan Raab 2016 年 4 月 23 日
I'm glad it works now. But I would use the t for the step function, not the Simulink model. The variable step solvers in Simulink are more powerful and now you force to simulate with a fixed step solver. This cannot adjust it's step size in order to achieve better accuracy and it cannot react to zero-crossings.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeneral Applications についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by