Problem with factorization of a matrix in a linear system
Show older comments
I just started working with MatLab and i cannot resolve this problem: Ax=b is a linear system with A as a matrix 18x18 symmetric 3-diagonal with all the elements equal to 6 on the principal diagonal and equal to 3 on the superior and inferior co-diagonals and b=linspace(5,8,18). You have to calculate eigenvalues of A. Considering the properties of these eigenvalues, solve Ax=b using 2 triangular systems and using the most efficient factorization of A. After that, sum the vector which is the solution of the superior triangular system with the other one (the solution of the inferior triangular system). Do the norm (1) of the result. Sorry for bad English. The correct answer is: 4.4944e+01 . Here is my solution but doesn't work:
A=zeros(18,18)+diag(6*ones(1,18),0)+diag(3*ones(1,17),1)+diag(3*ones(1,17),-1)
b=linspace(5,8,18)'
eigenv=eig(A)
x1=b\triu(A)
x2=b\tril(A)
x=x1+x2
n=norm(x,1)
Accepted Answer
More Answers (1)
I think the lu() or chol() commands are supposed to be in there. You should go read about them, of course.
Also, the solution to M*x=c is x=M\c, not x=c\M
1 Comment
John D'Errico
on 25 Aug 2017
Edited: John D'Errico
on 25 Aug 2017
A is SPD, so one of those choices might be better, as most efficient was stated.
Categories
Find more on Linear Algebra in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!