- #1
monsmatglad
- 76
- 0
I need to create a 121*121 matrix in matlab. Forty of the rows have to contain the sequence 0 1 0 0 1 -4 1 0 0 1. and the rest of the rows will have 0's and "one 1" per row. The sequence has to be pushed one step to the right from row 1 to 121, the result should be a matrix with only -4's and 1's on the diaogonal.
The first 12 rows will have the form:
1 0 0 0 0 0 0 0 0 0 0...
0 1 0 0 0 0 0 0 0 0 0...
0 0 1 0 0 0 0 0 0 0 0...
Then the rows with the -4's appear 9 times being separated by only two rows of type 1 and 0.
example:
1 0 0 0 0 0 0 0 0 0 0...
0 1 0 0 0 0 0 0 0 0 0...
0 0 1 0 0 0 0 0 0 0 0...
11 rows
then
9 rows of
0 1 0 0 1 -4 1 0 0 1 0 0 0 0 0 0 0 0 0...
0 0 1 0 0 1 -4 1 0 0 1 0 0 0 0 0 0 0 ...
0 0 0 1 0 0 1 -4 1 0 0 1 0 0 0 ...
after the 9 rows then two of only 1 and 0 again. and it continues like that for 110 rows down, with the remaining being like the twelve first with only 1 and zeros.
phew! Hope this is possible to understand. I have very little experience with programing, so I find this really hard.
2. Homework Equations
please ask for expanation if you don't understand.
3. The Attempt at a Solution
Mons
Reply With Quote
The first 12 rows will have the form:
1 0 0 0 0 0 0 0 0 0 0...
0 1 0 0 0 0 0 0 0 0 0...
0 0 1 0 0 0 0 0 0 0 0...
Then the rows with the -4's appear 9 times being separated by only two rows of type 1 and 0.
example:
1 0 0 0 0 0 0 0 0 0 0...
0 1 0 0 0 0 0 0 0 0 0...
0 0 1 0 0 0 0 0 0 0 0...
11 rows
then
9 rows of
0 1 0 0 1 -4 1 0 0 1 0 0 0 0 0 0 0 0 0...
0 0 1 0 0 1 -4 1 0 0 1 0 0 0 0 0 0 0 ...
0 0 0 1 0 0 1 -4 1 0 0 1 0 0 0 ...
after the 9 rows then two of only 1 and 0 again. and it continues like that for 110 rows down, with the remaining being like the twelve first with only 1 and zeros.
phew! Hope this is possible to understand. I have very little experience with programing, so I find this really hard.
2. Homework Equations
please ask for expanation if you don't understand.
3. The Attempt at a Solution
Mons
Reply With Quote