function x = UBiDiSol(u,f,b)
%------------------------------------------------------------------------------
% x = LBiDiSol(l,b)
% Solves the nXn upper bidiagonal system U*x = b
% where u, f and b are nX1 and U = diag(u) + diag(f(1:n-1),1)
%------------------------------------------------------------------------------
n = length(b); x = zeros(n,1);
x(n) = b(n)/u(n);
for i = n-1:-1:1
x(i) = (b(i) - f(i)*x(i+1))/u(i);
end