I want to convert few equations into matrix form >>>>>>
Show older comments
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 Comments
Dyuman Joshi
on 24 Nov 2022
It's quite simple, you just have to separate the terms and get the coefficients.
1st eq
A=[m1 0 c1+c2 -c2 k1+k2 -k2], B=0;
2nd eq
A=[0 m2 -c2 c2 -k2 k2], B=0;
Rahul Jangid
on 25 Nov 2022
Dyuman Joshi
on 25 Nov 2022
Edited: Dyuman Joshi
on 25 Nov 2022
Automatically? Meaning with a code?
Rahul Jangid
on 28 Nov 2022
Answers (2)
Mann Baidi
on 10 Sep 2023
0 votes
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
on 10 Sep 2023
0 votes
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()
Categories
Find more on Vibration Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!