This repository has been archived on 2021-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
NC/mp2/Project.2.Maggioni.Claudio/ex2.m
2020-10-07 15:39:10 +02:00

21 lines
No EOL
288 B
Matlab

n = 5;
A = sparse(n, n);
A(1,:) = 1;
A(end,:) = 1;
A(:,1) = 1;
A(:,end) = 1;
% make sure diagonal is 0
A(1,1) = 0;
A(n,n) = 0;
A = A + diag(n:(2*n-1));
spy(A);
matlab2tikz('../ex2_2_spy.tex');
figure;
subplot(1,2,1)
spy(A);
subplot(1,2,2)
spy(chol(A));
matlab2tikz('../ex2_3_spy.tex');