Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Question: Given is the following pipe system:


the pressure in a stationary state is at every end and cross-point (with exception of $K_i, i ={1,...,4}$) equal to the average pressure of the neighboring points. On $K_i$ with $i = \{1,...,4\}$ are valves with fixed pressure of $K_i = 10i$.

a) Create a system of linear equations to represent the values of the pressure on the points. b) Turn this system of linear equations into a matrix-vector representation. c) Solve this system of linear equations with matlab.

I'm having a lot of difficulty for some reason. I'm not sure if I'm on the right track by numbering the points from top left to bottom right as one does a matrix ($a_{ij}$). I believe the resulting equations would be somthing like:

$a_{11} = \frac{1}{3}(40 + a_{12}+a_{21})$

$a_{21} = \frac{1}{3}(a_{11} + a_{22} +a_{31})$

$a_{31} = \frac{1}{3}(a_{21} + a_{32} + a_{41})$

$a_{41} = \frac{1}{3}(10 +a_{31} +a_{42})$

and the 6 points in the middle would be of the form:

$a_{22} = \frac{1}{4}(a_{12} + a_{21} + a_{23} + a_{32})$

I don't see how I can put this into a matrix-vector form. Everytime that I try to use substitution(say $a_{11}$ into the equation for $a_{21}$ I am not sure which direction to go and I am thinking that I must be misunderstanding something.

At first I was visualising such a matrix equation:

$\left ( \begin{array}{ccccc} a_{11} & a_{12} &a_{13} &a_{14} &a_{15} \\a_{21} & a_{22} & a_{23} & a_{24} & a_{25} \\ a_{31}& a_{32}& a_{33}& a_{34}& a_{35} \\ a_{41}& a_{42}& a_{43}& a_{44}& a_{45}\end{array}\right ) \left( \begin{array}{c}x_1\\ x_2 \\ x_3 \\ x_4 \\ x_5 \end{array}\right ) = \left( \begin{array}{c} 40 \\ 30 \\ 20 \\ 10\end{array} \right)$

however, I think this must be nonsense, there are 5 unknowns and only 4 'equations'. I am assuming though, that I will be using the matlab "linsolve(A,b)" command, right? I am not even sure at this point what the $A$ and $b$ will be in this simple equation... If anyone could help me start getting this straight I would really appreciate it!

share|cite|improve this question
up vote 1 down vote accepted

You are close, but not quite visualising the matrix correctly. The five equations you write should be translated into usual form, as follows: \begin{align*} a_{11} -\frac{1}{3}a_{12} -\frac{1}{3}a_{21} &= \frac{40}{3}\\ a_{21} -\frac{1}{3}a_{11} -\frac{1}{3}a_{22} -\frac{1}{3}a_{31} &=0\\ a_{31} -\frac{1}{3}a_{21} -\frac{1}{3}a_{32} -\frac{1}{3}a_{41} &= 0\\ a_{41} -\frac{1}{3}a_{31} -\frac{1}{3}a_{42} &=\frac{10}{3}\\ a_{22} -\frac{1}{4}a_{21} -\frac{1}{4}a_{21} -\frac{1}{4}a_{23} -\frac{1}{4}a_{32} &=0 \end{align*} You get one equation for every node, so you should have a system with 20 equations and 20 unknowns (the unknowns being the pressure on each node).

That is, the unknowns are $a_{11},\ldots,a_{45}$; these are not the coefficients of the matrix of the system.

share|cite|improve this answer
ok thanks, so if I'm understanding properly, I'll have a 20 by 1 column vector full of unknowns, right? If so, the 'b' part is clear and hopefully I can manage to setup 'A' to replicate the linear system as you show above... – ghshtalt Jan 31 '11 at 17:49
@user3711: Yes: your vector of unknowns will have the $a_{ij}$ in it in an appropriate order. The $\mathbf{b}$ vector should contain only four nonzero entries, corresponding to the equations you get from looking at each of the corners. As this will be a $20\times 20$ system, it is no surprise you are being told to solve it using MatLab (as opposed to by hand)! – Arturo Magidin Jan 31 '11 at 17:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.