Create a loop for this matrix
Show older comments
1 -1 0 0 0 ...
-1 2 -1 0 0 ...
0 -1 2 -1 0 ...
0 0 -1 2 -1 ...
0 0 0 -1 2 ...
As you can see, this can go on forever, I and would like to find a way to write loop for a dynamic matrix where this just keeps going unitl a certain number 'N'
4 Comments
dpb
on 4 Jun 2021
What's the RH end condition definition?
Rayden Plasma
on 4 Jun 2021
David Fletcher
on 4 Jun 2021
Edited: David Fletcher
on 4 Jun 2021
I think they are asking what the end of the final row should be - I would guess [zeros(N-2,1) -1 1]
Rayden Plasma
on 4 Jun 2021
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!