Differntial equations and Initial conditions
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
1. What are the main considerations for selecting initial conditions for solving dynamics equations using Matlab Simulink. For instance, setting the initial conditions in the continuous state block or integral block?
2. Is it possible to use a mathematcal expression or relation instead of a number as the initial condition in the integral block of Simulink?
採用された回答
Paul
2021 年 3 月 28 日
- The initial conditions are set to represent the initial conditions of the system to be simulated. What other considerations might there be?
- Yes. Any expression can be used that returns a value that is consistent with the requirements for the initial condition of the block in question.
12 件のコメント
KaMATLAB
2021 年 3 月 28 日
Thank you for the reply. Now I have a system of differential equations that is about 32 set of differential equations. I have been able to use a single integrator for the simulink implementation. I have initial conditions that are mathematical expressions, which are derived from the steady state equillibrium conditions of each sets of the differential equations. My challenege is that I dont know how to insert each mathematical expressions of the initial conditions into the integral block. I have attached the intgeral block with some sample sets of initial condition which are constants.However I want expressions as attached also as the initial condition. The initial conditions are the calculated by equating the each differential equation to zero and make the desired state, the subject of the formula. Then it is the initial condition valeu at the equilibrium state. How do i realize such expression in the attached simulink matlab function i used to implement the system in the integral block.
May be there is a way to impelement Initial condition of large mathematical expression within the matlab function blokc used to solve the differential equations?
Thank you
Paul
2021 年 3 月 28 日
If you have a function in an m-file that computes the initial conditions, i.e., returns a 32-element vector, based on paramters you specify or defined in the base workspace, you can just enter that function in the Inital Condiiton paramter (where you have the 1's and 30'). More generally, you can enter any Matlab expression into the Initial Conditon that results in 32-element vector. Alternatively, you can specifcy the Initial Condition Source as External, and then compute the initial conditions as a 32-element vector output of another block in your model, and connect that block's output to the initial condition input to the integrator.
KaMATLAB
2021 年 3 月 28 日
@Paul thank you. Let me try to implement the 4 options suggested. Although this is my first time of reading or coming across these options. I will try to implement and let you know how it goes please. Or if if you could help with a demonstration using a simple m-file and integral block to demonstrate I would appreciate.
Thank you
KaMATLAB
2021 年 3 月 29 日
All the 32 equations have different initial condotion expressions. Now how to calculate each one in an m-file and then import to the integrator block is the challenge for me. I would be glad if you could give suggestions. Based on your opinion, seems to me that your method is applicable to the case of one mathematcial expression?
Paul
2021 年 3 月 29 日
Any Matlab expression, which includes function calls, and be used as the Initial Condition, as long as the expression results in the the 32-element vector of initial conditions. So you can develop one function (that calls other as necessary) that returns a 32-element vector of initial conditions and make that function call the parameter in the Initial Condition in the dialog of the Integrator block. Or you can put 32 function calls that each return a scalar into an array as the Initial Condition parameter, just like would be done at the command line
[func1(arg1,arg2,etc) func2(arg1,arg2,etc) etc func32(arg1,arg2,etc)]
KaMATLAB
2021 年 3 月 30 日
Thank @Paul I will implement it. each initial condition has its own unique mathematical expression. I think, if i write a m-file script that calculate each. Then i can use 'from workspace block' to import the initial conditions to the Integrator block using the external initial condition of the integrator to connect with the 'from workspace blcok'. I think it should work?
Paul
2021 年 3 月 30 日
That approach can work, seems like overkill. Sounds like you have a script that results in a 32-element vector of initial conditions in the base workspace. Let's call that vector x0. Why not just set the Integrator "Initial condition source" to "internal" and put x0 in the field for "Initial condition:"
KaMATLAB
2021 年 3 月 30 日
Can you please let me know how you would have writen different equations to be in vector form at the end. I feel may be by indexing each result of the mathematical expressions as may be X(1)...........X(32) using assignment?
Paul
2021 年 3 月 30 日
Let X0 be the vector of initial conditions. One approach would be to compute
X0(1) = ....
X0(2) = ....
i.e., fill in each element X0 with the initial condition cacualtion in the base workspace. Then X0 is the Initial Condition parameter in the Integrator block.
KaMATLAB
2021 年 3 月 31 日
Great! perfect!!! thank you so much
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Event Functions についてさらに検索
参考
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
