MATLAB: How do i complete this matrix that has n+1 rows and m columns

MATLABmatrix

This stops at the 2nd row of the matrix, How can i get the whole matrix? Also, can someone explain what is going on?
function phi_values = phi_part1(a_vec, b_vec, x_vec)
n = length(a_vec);
m = length(x_vec);
phi_values = zeros(n + 1, m);
phi_values(1, :) = 1 / sqrt(b_vec(1));
a0 = a_vec(1);
b1 = b_vec(2);
phi_values(2, :) = ((x_vec - a0) .* phi_values(1, :)) / sqrt(b1);
k = 2;
%%phi_values(k + 1, :)
bk = b_vec(k + 1);
bk_minus_1 = b_vec(k);
ak_minus_1 = a_vec(k);
left_quantity = ((x_vec - ak_minus_1) .* phi_values(k, :));
right_quantity = sqrt(bk_minus_1) * phi_values(k - 1, :);
phi_values(k + 1, :) = (left_quantity - right_quantity) / sqrt(bk);
end

Best Answer

"stops at the 2nd row of the matrix" &nbsp Firstly, I think it stop at the third row. Why shouldn't it stop after assigning values to three rows? I have indicated with &nbsp|<< n >>| &nbsp the rows, which do these tree assignments.
Secondly, I have added a for-loop, guessed regarding the input values and invoked the function
a_vec = randi( [1,9], [1,8] );
b_vec = randi( [1,6], [1,9] );
x_vec = randi( [1,9], [1,4] );
phi_values = cssm( a_vec, b_vec, x_vec )
phi_values =
0.4472 0.4472 0.4472 0.4472
-0.3162 -0.3162 0 0.3162
-0.6455 -0.6455 -0.2582 0.3873
2.0656 2.0656 0.2582 -0.7746
5.1430 5.1430 0.8944 -2.9069
3.8730 3.8730 1.2910 -5.9386
2.9445 2.9445 2.1939 -13.6832
1.3943 1.3943 3.6148 -30.7773
-7.6133 -7.6133 -8.5810 43.3979
where
function phi_values = cssm( a_vec, b_vec, x_vec )
n = length(a_vec);
m = length(x_vec);
phi_values = zeros(n + 1, m);
phi_values(1, :) = 1 / sqrt(b_vec(1)); % << 1 >>
a0 = a_vec(1);
b1 = b_vec(2);
phi_values(2, :) = ((x_vec - a0) .* phi_values(1, :)) ...
/ sqrt(b1); % << 2 >>
for k = 2 : n;
%%phi_values(k + 1, :)
bk = b_vec(k + 1);
bk_minus_1 = b_vec(k);
ak_minus_1 = a_vec(k);
left_quantity = ((x_vec - ak_minus_1) .* phi_values(k, :));
right_quantity = sqrt(bk_minus_1) * phi_values(k - 1, :);
phi_values(k + 1, :) ...
= (left_quantity - right_quantity) / sqrt(bk); % << 3 >>
end
end