Problem 1812. Tridiagonal
Return an n-by-n matrix that has a, b, c as the subdiagonal, main diagonal, and superdiagonal entries in the matrix.
Example
a=1 b=2 c=3 n=5 T = [2 3 0 0 0; 1 2 3 0 0; 0 1 2 3 0; 0 0 1 2 3; 0 0 0 1 2]
Solution Stats
Problem Comments
-
5 Comments
Show
2 older comments
J.R.! Menzinger
on 14 Aug 2013
did you mean n=4 and not d=4?? ;-)
Nicolae Preda
on 14 Aug 2013
it seems that the test code is broken n!=d
Ned Gulley
on 15 Aug 2013
I fixed the test suite so that n is used instead of d.
goc3
on 15 Mar 2017
Additional test cases have been added.
Robert Ritter
on 13 Dec 2021
great!
Solution Comments
Show commentsProblem Recent Solvers143
Suggested Problems
-
Back to basics 12 - Input Arguments
589 Solvers
-
Split a string into chunks of specified length
1654 Solvers
-
822 Solvers
-
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
371 Solvers
-
Find the sides of an isosceles triangle when given its area and height from its base to apex
1843 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!