Systems of equations in matlab

1. Aug 20, 2011

loukoumas

hello everybody!

T1=A T1'+B(T0'+T2'+T0+T2)
T2=A T2'+B(T1'+T3'+T1+T3)
T3=A T3'+B(T2'+T4'+T2+T4)
if A,B,T0,T4 and everything in (') character is known, i have T1,T2,T3 to find and 3 equations. how do i use matlab to solve this?(i have a 9X9 system to solve but i guess it's the same)

Also,good someone know why i can't save my notebooks in mathematica?
It gives me a message about wrong path!

thank you very much

2. Aug 21, 2011

uart

Rewrite your equations so that you have linear combinations of the unknowns on the LHS and fold all the constants together on the RHS. For example with the first of your equations,

1 T1 - B T2 + 0 T3 = (A T' + B T0' + B T2' + B T0)

When you've finished you'll be able to write your set of equations in matrix form Mt = c, where M is a matrix, t the vector $[T1,T2,T3]^T$ and c is a vector of your constants.

Hint. From the above, the first row of M would be [1, -B, 0].

Last edited: Aug 21, 2011
3. Aug 21, 2011

loukoumas

"For example with the first of your equations,

1 T1 - B T2 + 0 T3 = (-A T' + B T0' + T0)" wouldn't be the RHS a little different??
1 T1 - B T2 + 0 T3 = A T1' + B ( T0' + T2' + T0 )

4. Aug 21, 2011

loukoumas

if i am right about the RHS, my system will get at the form:
[M]t=A t' + [N] t' + B c where c is [T'0+TO
0
T'4+T4]
How matlab can now help me? i guess i need to leave t alone on the LHS!
i haven't worked in matlab before, so i know so little about it
thank you for your time and of course for your help

5. Aug 21, 2011

uart

Yeah I fixed the typo's on the RHS. I was trying to type that while cooking dinner.

If you have numerical values for everything that you said is "known", then you can construct matrix M and vector c (with actual numbers right).

In matlab you can solve the equation M t = c by just pre-multiplying both sides by the inverse of M

t = inv(M) * c

6. Aug 21, 2011

uart

Just to add one thing. While using the matrix inverse is a good way to solve a set of equations if you know that they have a unique solution, in general it is often better to use "row reduce" which is both efficient and can handle the case where there is not a single solution.

To use row reduction you should augment the vector c to the matrix, as in X = [M , c], and then just type rref(X) to row reduce it.

BTW. The rather cryptically named rref() function stands for "Row Reduced Echelon Form".

Last edited: Aug 21, 2011