My current solution is to create an outer loop which increments the number of additional continued fractions whilst still solving "backwards" in an inner loop as shown below. It doesn't feel like the most efficient way of doing things mind you.
%% Laplace Continued Fraction
z = 20.0*exp(1i*5*pi/8)
r = 1.0;
nterms = 10;
i = 1;
for j = 1:nterms % Outer loop - iterate # of additional continued fractions
for k = i:-1:1 % Inner loop - backwards last term to first
if k == i % Last term only divided by z;
b = k/2/z;
else
b = k/2;
end
r = 1/(z-b*r);
F4_store(j) = 1i/sqrt(pi)*r; % Store each iteration
end
i = i+1;
r = 1.0; % Reset r for additional continued fraction
end