simulink is giving unexpected simulation answer

I am trying to simulate the following block diagram
which simulates the equation : with the second integrator having the initial condition of 1.
where this equation can have the solution :
but upon simulation I got the following result:
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 件のコメント

Walter Roberson
Walter Roberson 2024 年 9 月 6 日
It looks to me as if you need to zoom in to see the cos() behaviour
abdo
abdo 2024 年 9 月 6 日
actually yes, but I mean why the change in magnitude of the cosine wave until it reach stability. I am still exprimenting with it and for now I discovered it had something to with but still don't know what.
Walter Roberson
Walter Roberson 2024 年 9 月 6 日
I would be more surprised if the system were immediately stable. It takes time to reach equilibrium.
Sam Chak
Sam Chak 2024 年 9 月 6 日
Can you you show us the scope when wo is set to 1?
abdo
abdo 2024 年 9 月 6 日
@Sam Chak, I set wo to 1 and I got a nearly stable cosine wave

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

 採用された回答

Sam Chak
Sam Chak 2024 年 9 月 6 日

1 投票

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
Sam Chak 2024 年 9 月 7 日
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.
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')
ans = 'auto'
% 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')
ans = '0.01'

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeProgrammatic Model Editing についてさらに検索

製品

リリース

R2022b

タグ

質問済み:

2024 年 9 月 6 日

コメント済み:

2024 年 9 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by