1
$\begingroup$

$\begin{align} x_1 &= 20000+0.5x_2+0.1x_3 \\ x_2 &= 40000+0.2x_1+0.6x_3 \\ x_3 &= 20000+0.1x_1+0.25x_2 \end{align} $ I want to write the system as $Ax=b$, what will then $A$, $b$ and $x$ be? I suppose $x$ should be $[x_1, x_2, x_3]$ but then I must solve for all of the variables?

Update

Did I formulate the system correctly as $Ax=b$? $A=\begin{pmatrix} -1 & 0.5 & 0.1 \\ 0.2 & -1 & 0.6 \\ 0.1 & 0.25 & 1 \end{pmatrix} $ $ b=\begin{pmatrix} -20000 \\-40000 \\-20000 \end{pmatrix} $ and $ x=\begin{pmatrix} x1 \\ x2 \\x3 \end{pmatrix} $

Update 2

I think I got it right, did it this way in matlab:

>> A=[-1 0.5 0.1;0.2 -1 0.6;0.1 0.25 -1]  A =     -1.0000    0.5000    0.1000     0.2000   -1.0000    0.6000     0.1000    0.2500   -1.0000  >> b=[-20000 -40000 -20000]'  b =        -20000       -40000       -20000  >> x=A\b  x =    1.0e+004 *      6.5248     8.1135     4.6809  >>  
  • 0
    @Daryl Of course, it should be -1. Now I understand this part and can go on with formulating it in matlab. Thanks for the help.2012-09-05

2 Answers 2

2

[I will add this as an answer.]

EDIT: I had the wrong operator. I have updated all operators to \ which is the correct operator to solve $Ax=b$. The operator / solves $A^Tx=b$.

You will need to form $A$ and $b$ by hand. You can then use x=A\b to solve the linear system $Ax=b$.

Your matrix $A$ is almost correct. The $(3,3)$ entry should be $-1$, not 1.

For help with the \ operator, at the MATLAB prompt, type help mldivide.

  • 0
    Thank you for the answer. I exercised the solution in matlba and updated the question with the numbers I got that I also could verify fit the equations. So it must be right.2012-09-05
1

sol1 = inv(A)*b; it's the most simplest question

  • 1
    @M-AskmanYou definitely want to use the '\' operator for solving standard linear systems. The use of 'inv()' is rather costly (see example in reference)! http://www.mathworks.co.uk/help/techdoc/ref/inv.html2012-09-05