Why do the same system matlab and simulink get different step responses?

10 次查看(过去 30 天)
As I asked, I want to design a fractional pid controller for a model. Unfortunately, the results I got with step in matlab are quite different from those in simulink
.
Here the orange line is the output and the blue line is the offset,Now let me show you the situation of matlab.The specific parameters of the controller are consistent with the code below
cs=fopid(9.503084707494814e+03,1.889631254823942e+02,2.304958553299564e+02,0.058440555124293,1.558103446462550);%This is parameter of controller
gs=tf(118700,[1 1085 1224000]);%This is the transfer function of the controlled object
step(feedback(cs*gs,1))%Step Response of Closed-loop Transfer Function
This is the general situation. I feel confused now.
  1 个评论
Sam Chak
Sam Chak 2024-7-25
Hi Fan, I believe that you have used the custom Simulink block and fopid() function file for the problem.
Without knowing what's inside the fractional order PID controller block mask, and the block configuration, it's difficult to identity the root cause.

请先登录,再进行评论。

回答(1 个)

tom
tom 2024-7-25
Differences in step responses between MATLAB and Simulink can arise due to:
  1. Solver Settings: Simulink uses various numerical solvers which may differ from MATLAB’s fixed algorithms.
  2. Time Representation: Discrete vs. continuous time implementations can cause variations.
  3. Initial Conditions: Ensure both systems have the same initial conditions.
  4. System Representation: Simulink’s block diagram approach may introduce numerical differences compared to MATLAB’s state-space or transfer function methods.
  5. Model Complexity: Simulink models might include nonlinear elements that MATLAB assumes linear.
To align results:
  • Use similar solver settings.
  • Match initial conditions.
  • Ensure consistent time representation.
  • Simplify Simulink models to match MATLAB’s analytical models.
  • Compare intermediate outputs to identify discrepancies.

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by