I want to convert few equations into matrix form >>>>>>

4 ビュー (過去 30 日間)
Rahul Jangid
Rahul Jangid 2022 年 11 月 24 日
回答済み: Walter Roberson 2023 年 9 月 10 日
Can some one help me to convert those equations into matrix form
Where the form of matrix is as A*X = B where X = [diff(x1(t), t, t); diff(x2(t), t, t); x1d; x2d; x1; x2]
the equations are as shown below:
m1*diff(x1(t), t, t) + c1*x1d + k1*x1 + (c2*(2*x1d - 2*x2d))/2 + (k2*(2*x1 - 2*x2))/2 == 0
m2*diff(x2(t), t, t) - (c2*(2*x1d - 2*x2d))/2 - (k2*(2*x1 - 2*x2))/2 == 0
  4 件のコメント
Dyuman Joshi
Dyuman Joshi 2022 年 11 月 25 日
編集済み: Dyuman Joshi 2022 年 11 月 25 日
Automatically? Meaning with a code?
You can use collect. Other than that, I think it's highly unlikely you can do it 'automatically'
Rahul Jangid
Rahul Jangid 2022 年 11 月 28 日
yeah i want to do it using code bcz the actual problem i am solving have very complex and around 12 variables.

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

回答 (2 件)

Mann Baidi
Mann Baidi 2023 年 9 月 10 日
Hi Rahul,
I understand you would like to convert variable equation into a matrix form. Currently, MathWorks don’t have a function for this. You would have to make the matrix manually. For more information, you can refer to the following answer.
Thanks!

Walter Roberson
Walter Roberson 2023 年 9 月 10 日
I recommend that you examine the work-flow of the first example of odeFunction as that shows converting orders and gathering terms and building mass matrix, and generating anonymous functions for use with routines such as ode45()

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by