simulink is giving unexpected simulation answer
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to simulate the following block diagram
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1768294/image.jpeg)
which simulates the equation :
with the second integrator having the initial condition of 1.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1768299/image.png)
where this equation can have the solution : ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1768304/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1768304/image.png)
but upon simulation I got the following result:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1768309/image.jpeg)
I can notice the mathematical solution doesn't follow actual simulation where the simulation will always produce sinusoidal trying to reach stability state which is the oscillation between (inital_condition / 2) and (-inital_condition / 2). so why doesn't the mathematical solution match the simulation.
댓글 수: 5
채택된 답변
Sam Chak
2024년 9월 6일
Nope, not stable. The reason you got the high oscillations exponential decay response is because there are not enough samples for the scope to plot it out correctly.
Solution: Use a smaller time step, preferably (2π/wo)/100.
댓글 수: 1
Sam Chak
2024년 9월 7일
Hi @abdo salm
You set the time step at the Model Configuration Parameters > Solver Pane. The simulation time step size is specified using the Max step size parameter, if the variable-step solver is selected.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1768474/image.png)
Or, you can set the value from the Command Window. In the following example, the Simulink model 'vdp.slx' is opened. Use the 'get_param()' command check the current value, and then the 'set_param()' command to set the desired value.
openExample('simulink_general/VanDerPolOscillatorExample');
% Check the Maximum time step size for variable-step solver
get_param('vdp', 'MaxStep')
% Set the Maximum time step size to 0.01, preferably using this formula (2π/wo)/100
set_param('vdp', 'MaxStep', '0.01')
% Check the Maximum time step size again
get_param('vdp', 'MaxStep')
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 General Applications에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!