Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating a diagonal matrix in matlab

Status
Not open for further replies.

charlieryan

Aerospace
Jul 23, 2007
2
hi

I'd like to create a matrix that looks something like;

a c 0 0 0 0
b a c 0 0 0
0 b a c 0 0
0 0 b a c 0
0 0 0 b a c
0 0 0 0 b a

Where b, a, and c are contants. I'l like to be able to set the matrix size as well [the matrix should be square].
Any ideas
thanks!

Charlie
 
Replies continue below

Recommended for you

Hi,

one of the many solutions :

Code:
n=6;
toeplitz([a b zeros(1,n-2)],[a c zeros(1,n-2)])

Jérôme
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor