How to set initial condition y(1)=1 in solving ODE using Simulink?

11 ビュー (過去 30 日間)
Yugal Maheshwari
Yugal Maheshwari 2018 年 12 月 23 日
コメント済み: Yugal Maheshwari 2018 年 12 月 30 日
Can anyone guide me how can I set initial conditions for ODE in Simulink. It is easy to set Y(0)=0 or 1 in integerator. How to set Y(1)=1 in integrator.
I wanna solve dy/dt= (2/t) y , where y(1)=1 as initial condtions in Simulink.
  2 件のコメント
Aquatris
Aquatris 2018 年 12 月 26 日
If y(1) = 1 is your initial condition, it means your starting "time" is 1. Why not just set the integrator initial to 1 and offsett the time value whereever it appears in your equations?
Yugal Maheshwari
Yugal Maheshwari 2018 年 12 月 30 日
Yes, it works. Thanks!

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

回答 (1 件)

Akshay Khadse
Akshay Khadse 2018 年 12 月 28 日
As Aquatris mentioned, the Start Time for simulation should be specified as 1 from the Configuration Parameters.
Then, you can specify the initial condition using any of the following methods:
1) Specify the Initial condition in the Integrator block parameters as 1. OR
2) Use Simulink.BlockDiagram.getInitialState as follows
x0 = Simulink.BlockDiagram.getInitialState(gcs);
x0{1}.Values.Data = 1;
Please refer the following documentation page to know more about the Simulink.BlockDiagram.getInitialState

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by