%
% A06C.m 
%
% Vectorized version of A06A.m and A06B.m. This function uses the vector
% capabilities of the sin() function rather than using a for loop.
% Array t is preallocated and then the y values are calculated using
% y = sin(t). Simple. And fast!
%
% Matlab-Monkey.com
% 12/30/2014

% tidy-up your workspace
clc         % clear command window
clear       % clear all variables
close all   % close all graphics windows


N = 1e8;                % set the number of point to 10^8

tic;                    % start timer to measure computation time

t = linspace(0,2*pi,N); % define an array of N equally spaced t values
y = sin(t);             % evaluate sin(t)

tElapsed = toc;         % measure elapsed time since timer started

% display elapsed time to command window
fprintf('elapsed time = %.3g seconds\n',tElapsed);
