Arrange linear equation w.r.t variables
Show older comments
Hello,
How I can arrange the following linear equations such that it results same equations but with sequence of a,b,c and d?
R =
[0.8978*c - 0.8047*b - 0.020299*a, 0.8978*d - 0.094800*b - 0.106799*a]
[ 0.091199*a + 0.13200*c - 0.8047*d, 0.091199*b - 0.106799*c + 0.0575*d]
Thanks.
Answers (1)
Thorsten
on 28 Jan 2013
The columns are a, b, c, d and the values in row 1, 2, 3 are the coefficients in your equation 1, 2, 3. Use zero if there is no coefficient, such as for d in your first equation
>> R = [-0.020299 -0.8047 0.8978 0 ; -0.106799 -0.094800 0 0.8978; 0.091199 0 0.13200 -0.8047; 0 0.091199 -0.106799 0.0575]
R =
-0.0203 -0.8047 0.8978 0
-0.1068 -0.0948 0 0.8978
0.0912 0 0.1320 -0.8047
0 0.0912 -0.1068 0.0575
You can then compute a solution to R*[a;b;c;d] = [1;5;30;4] (for example) by
R\[1;5;30;4];
2 Comments
SMK
on 29 Jan 2013
Thorsten
on 29 Jan 2013
Convert each equation of the sort c1*a + c2*b + c3*c + c4*d to a row of your matrix
c1 c2 c3 c4
So for example 0.8978*c - 0.8047*b - 0.020299*a gives values c4 = 0 (because there is no d), c3 = 0.8978 (the coefficient in front of c), c2 = -0.8047 (the coefficient in front of b) and finally c1 = -0.02099 (the coefficient in front of a):
-0.0203 -0.8047 0.8978 0
Same for the other terms you have.
Categories
Find more on Linear Algebra in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!