Problem with calculating recursive equation
Sorry for answering like this but I cannot comment since my reputation is not sufficient, but yet I want to help.

It is a filter and you can do it way easier, and more quickly than just building an algorithm(in Matlab ofcourse). It will take relatively a long post to cover all the concepts in order to make a sufficient understanding about filter designs. 

However, I can help you about which topics you should cover.

Please take a look at FIR/IIR filters (Your recursive equation is basically an IIR filter) and Z-Transform topics. 

If you need a quicker way to learn about IIR filter this lecture will give you some information.