Why do the same system matlab and simulink get different step responses?
8 次查看(过去 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
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
2024-7-25
Differences in step responses between MATLAB and Simulink can arise due to:
- Solver Settings: Simulink uses various numerical solvers which may differ from MATLAB’s fixed algorithms.
- Time Representation: Discrete vs. continuous time implementations can cause variations.
- Initial Conditions: Ensure both systems have the same initial conditions.
- System Representation: Simulink’s block diagram approach may introduce numerical differences compared to MATLAB’s state-space or transfer function methods.
- 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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!