Problem to implement a sinusoid oscillator in matlab
OK, since the original code was changed a bit, here is the complete solution (with some useful modifications):

n=1000;
w0=pi/16;
beta=1;
alpha=2*cos(w0);
y=zeros(1,n);
y(1)=0;
y(2)=sin(w0);

for i=3:n
    y(i)=alpha*y(i-1)-beta*y(i-2);
end

stem(y)
% End of code