Solution Vector for Matrix from Upper Bandwith, transformed vector, and upper triangular result
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
back_subst_banded.m
Modify the backward substitution algorithm to take advantage of the upper bandwidth of an upper triangular system. No arithmetic should be performed on any element known to be zero.
Inputs:
U The upper triangular result
d The transformed right-hand-side vector
ub The upper bandwidth, i.e., the number of stripes above the matrix diagonal that have non-zero elements.
Outputs:
x The solution vector
. . . .. So far this is what I have:
Function x= back_subst_banded(U, d, ub)
% U= upper triangular result from gaussbandfunc, d= transformed
%right hand vector for gaussbandfunc, ub= upper bandwith
format short
p = (1:ub)'; % initialize the pivoting vector
s = max(abs(A')); % compute the scale of each row
for k = 1:(ub-1)
r = abs(A(p(k),k)/s(p(k)));
kp = k;
for i = (k+1):bb
t = abs(A(p(i),k)/s(p(i)));
if t > r, r = t;
kp = i;
end
end
l = p(kp);
p(kp) = p(k);
p(k) = l; % interchange p(kp) and p(k)
for i = (k+1):ub
A(p(i),k) = A(p(i),k)/A(p(k),k);
for j = (k+1):ub
A(p(i),j) = A(p(i),j)-A(p(i),k)*A(p(k),j);
end
end
end
d = zeros(bb,1);
d(1) = b(p(1));
for i = 2:ub
d(i) = b(p(i));
for j = 1:(i-1)
d(i) = d(i)-A(p(i),j)*d(j);
end
end
d
. . . . .
. . Im not sure how to use the upper bandwith to get my solution vector here
Respuestas (0)
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!