The most important change is that I've moved the lines
outside the for loop. The values of this vectors are not initialize in each for loop actually, so they can be moved safely.
I have done other changes to make the code shorter and to save some for loops. matlab prefers things in matrix form.
By the way, the error that you mentioned before should occur in your original code as well. The error occurs in the line
and it occurs because sum(...) gives you a number while interest_rate_vector is a vector, and therefore cannot be multiplied using .*. In the code I wrote, this is replaced by *. Anyway, there is still the problem that you are trying to save a vector in Y(k,1), which is only one element, and that cannot be done. So you should check that the your code is right or clarify what Y really is (perhaps a cell array or so).