Hello
I'm trying to form a consolidation matrix to compute one-dimensional soil consolidation (settlement).
The matrix is formed by taking values from values from previous columns and rows of the matrix and
I don't get this to work.
In the matrix the horizontal axis ( j ) represents time steps and the vertical axis different depth nodes ( i ).
Each node point is a value of
, where the multiplier ct/z^2 is repleced by factor beta.
The values in the first column are given u0
The first row should be only 0 -values
and the last row should be determined by function
Thank you for your help.
Solved! Go to Solution.
The error occurs because your block with four if statements does not cover all possibilities. If i=0 only the cases j=0 and j=1 are covered. i=0 and j=2 throws the error.
If you fix this, you get another error because you are using u_0 like a 2D-matrix, accessing the second column values which don't exist because u_0 is just a one column vector. I guess a couple of u_0's where meant to be u.all's.
BTW, you have defined u_0 as a 1x1 matrix containing a 9x1 vector. Guess this was not done on purpose. You should use the literal index for u.0 and I think it was meant to be a 8x1 vector only.
But the next problem would be waiting around the corner. To calculate a matrix element you need to already know the three elements to its left in the current, the previous and the next row. So you can only build up the matrix column by column. The way you nested your two loops would try to build the matrix row by row, which will fail, because you try to use values from the next row which not already exist. You have to switch inner and outer loop (simply switch i and j 😉
WE
The error occurs because your block with four if statements does not cover all possibilities. If i=0 only the cases j=0 and j=1 are covered. i=0 and j=2 throws the error.
If you fix this, you get another error because you are using u_0 like a 2D-matrix, accessing the second column values which don't exist because u_0 is just a one column vector. I guess a couple of u_0's where meant to be u.all's.
BTW, you have defined u_0 as a 1x1 matrix containing a 9x1 vector. Guess this was not done on purpose. You should use the literal index for u.0 and I think it was meant to be a 8x1 vector only.
But the next problem would be waiting around the corner. To calculate a matrix element you need to already know the three elements to its left in the current, the previous and the next row. So you can only build up the matrix column by column. The way you nested your two loops would try to build the matrix row by row, which will fail, because you try to use values from the next row which not already exist. You have to switch inner and outer loop (simply switch i and j 😉
WE
Thank you for your review and advices, I think I got it working now!
I think you also had two errors in the indices in your equations.
Hope the attached sheet does what you intend.