CS代考 function x = backsolve(A,b)

function x = backsolve(A,b)
% solve the upper triangular linear system Ax = b
n = length(b);
if any(size(A) ~= [n n])

Copyright By PowCoder代写 加微信 powcoder

error(‘lengths not compatible’)
x = zeros(n,1); % column vector, otherwise get error
for j=n:-1:1
rhs = b(j) – A(j,j+1:n)*x(j+1:n); % dot product of jth row of A
% starting to the right of the
% diagonal with the part of x that is
% already known
x(j) = rhs/A(j,j);

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com