0

I have to solve following linear equation in Matlab

AX=B for X, where A - symetric positive definite upper triangular matrix (nxn), and B is matrix (mxn).

So far I have got code for solving such eqation where B is a vector. I have to change the code, to be able to calculate it for B as a (mxn) matrix

x(n)=b(n)/A(n,n);
for i=n-1: -1:1,
    s=b(i);
    for j=i+1:n,
        s=s-A(i,j)*x(j);
    end
    x(i)=s/A(i,i);
end
hegendroffer
  • 123
  • 1
  • 13
  • I cannot do this in such a way - I have to expand my code – hegendroffer May 17 '16 at 10:40
  • If you understood how Gaussian elimination works for vectors `B` and `X`, you should be able to understand how it works for matrices. Take a pen and a piece of paper and write the equations by hand for 2x2 matrices, it'll help you grab the idea – BillBokeey May 17 '16 at 11:21
  • You can use *analytical* solution, which is GEM, as BillBokeey suggested. You can use *numerical* solutions, for example Jacobi method, or use alerady programmed solution, like `A\B`, as percusse suggested. – Crowley May 17 '16 at 11:34

0 Answers0