solving the differential equation

5 ビュー (過去 30 日間)
Hannah Mohebi
Hannah Mohebi 2022 年 4 月 22 日
コメント済み: Walter Roberson 2022 年 4 月 25 日
I want to solve the below equations. In these equations Q,Tp are variables, and italic underlined alphabets are constant. Also, Irr and Te are matrices with one row and 18 columns. I want to obtain Q and Tp as matrices with one row and 18 columns according to the amount of Irr and Te. My question is 'how can I solve these equations'?
dQ/dt=A * Irr * Tp + B * Te * Tp
if Q<C
Tp=D* Q
if E<Q<F
Tp=H
if Q>G
Tp=M* Q
  1 件のコメント
Torsten
Torsten 2022 年 4 月 22 日
As already answered in a previous question, use ode45 or ode15s to solve for Q1,Q2,...Q18.

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

回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 4 月 22 日
Your system cannot work.
dQ/dt=A * Irr * Tp + B * Te * Tp
You say that Irr and Te are matrices with one row and 18 columns. If, hypothetically, Tp was scalar, then dQ/dt would be the sum of two expressions that were each 1 x 18 and the result would be 1 x 18, which would be (locally) self-consistent so far.
Then you reach the if and you see the first branch and last branch assign Tp = constant times Q. But Q is 1 x 18, so Tp would have to be 1 x 18, contradicting the assumption that Tp is scalar.
So we have to go back to
dQ/dt=A * Irr * Tp + B * Te * Tp
this time with the assumption that irr and Te and Tp are each 1 x 18. But you have Irr * Tp and that is a (1 x 18) * a (1 x 18). Which is an invalid operation, inner product between two row vectors.
You cannot get the correct sizes out unless you use element-by-element multiplication, .* instead of inner product, *
  2 件のコメント
Torsten
Torsten 2022 年 4 月 23 日
編集済み: Torsten 2022 年 4 月 23 日
For Q, Tp, Irr and Te being 1x18 and elementwise multiplication in
dQ/dt=A * Irr .* Tp + B * Te .* Tp
the if-statement could be interpreted elementwise:
if Q(i)<C
Tp(i)=D* Q(i)
if E<Q(i)<F
Tp(i)=H
if Q(i)>G
Tp(i)=M* Q(i)
(1<=i<=18)
At least this is the only interpretation that makes sense.
Walter Roberson
Walter Roberson 2022 年 4 月 25 日
In later postings the dQ expressio got revised to not have the multiplication by Tp .

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

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by