% Demo2  ( Compare with demo 1 )
% Shows the time to calculate of 30.000 values
% using a for-loop and preallocation of vector
clear
tic
tmax=30000;
y=zeros(1,tmax);
for t=1:tmax
    y(t)=cos(t);
end
toc