So using the formula on this page Title

i need to linearly interpolate a function... i have set up two arrays t=0:20 and tt=0:.1:20.... (ps. not allowed to use the matlab interpolation function) ...this is what i have written. obviously it is no good, but can someone further explain what i need to do or fix or point me in the right direciton? Thanks

t=0:20;

y=exp(-t/10).*cos(t);

tt=0:.1:20;

for i=1:floor(tt)

yy(i)=y(i)+((y(i+1)-y(i))./(t(i+1)-t(i))).*(t-t(i))

end

i know that a point t on the curve in this case is equal to floor(tt(i))... how do i index this into y(_)