# To construct d we rst create a zero matrix of

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: agonals. The ﬁrst n − 1 entries of the ﬁrst column of “D” store the lower diagonal. The n entries of the second column of “D” store the main diagonal. The second through the last entries of the third column of “D” store the upper diagonal. To construct “D”, we ﬁrst create a zero matrix of dimensions n × 3: D = zeros(n,3); Then, we set the ﬁrst n − 2 entries of the ﬁrst column to h1 , h2 , . . . , hn−2 : D(1:n-2,1) = h(1:n-2); The (n − 1)th entry of the ﬁrst column has been initialized to zero already. Next, we set the entries of the second column to 1, 2(h1 + h2 ), . . . , 2(hn−2 + hn−1 ), 1: D(:,2) = [1; 2*(h(1:n-2)+h(2:n-1)) ;1]; 7. (Ex.) Add a line that ﬁlls in the second through the last entries of the third column of “D” accordingly. 8. Convert the diagonals “D” to an n × n matrix “A” in sparse form. Sparse form is used to store matrices with many zero entries. In this form, only the non-zero entries and their locations are stor...
View Full Document

## This document was uploaded on 10/10/2013.

Ask a homework question - tutors are online