rajivn786
Newbie level 2
matlab large matrices
Hi,
Can anyone tell me how to generate the following matrices using Matlab
B = [ 1
2
3
.
.
.
800]
800*800 coefficient matrix A is diagonally banded with a string of 4's down the main diagonal, a string of -1's down each of the 4 diagonals below and 4 above the main diagonal, and each of the diagonals directly above and below the main diagonal consists of the vector that starts off with [-1 -1 -1] and repeatedly takes the sequence [0 -1 -1 -1] onto this until the diagonal fills
A = [4 -1 0 0 -1 0 0 0.................. 0
-1 4 -1 0 0 -1 0 0................... 0
0 -1 4 -1 0 0 -1 0 ................... 0
0 0 -1 4 0 0 0 -1 0 0
-1 0 0 0 4 -1 0 0 ................ 0 0
0 -1 0 0 -1 4 -1 0 .................0 0
.
.
.
.
0
0 0 ----- -1 0 0 -1 4 -1
0 0 0 ... 0 -1 0 0 -1 4]
Hi,
Can anyone tell me how to generate the following matrices using Matlab
B = [ 1
2
3
.
.
.
800]
800*800 coefficient matrix A is diagonally banded with a string of 4's down the main diagonal, a string of -1's down each of the 4 diagonals below and 4 above the main diagonal, and each of the diagonals directly above and below the main diagonal consists of the vector that starts off with [-1 -1 -1] and repeatedly takes the sequence [0 -1 -1 -1] onto this until the diagonal fills
A = [4 -1 0 0 -1 0 0 0.................. 0
-1 4 -1 0 0 -1 0 0................... 0
0 -1 4 -1 0 0 -1 0 ................... 0
0 0 -1 4 0 0 0 -1 0 0
-1 0 0 0 4 -1 0 0 ................ 0 0
0 -1 0 0 -1 4 -1 0 .................0 0
.
.
.
.
0
0 0 ----- -1 0 0 -1 4 -1
0 0 0 ... 0 -1 0 0 -1 4]