%shows the difference between computing constants inside the loop verses %outside the loop n=10000000; f=ones(1,n); tic for i=3:n f(i)=log(2)*(f(i-1)+f(i-2)); end t1=toc f=ones(1,n); tic a=log(2); for i=3:n f(i)=a*(f(i-1)+f(i-2)); end t2=toc