stub of the function scripts

This commit is contained in:
2015-11-06 16:50:19 +01:00
parent 5b8ff9b59c
commit 86978d4d41
3 changed files with 291 additions and 21 deletions

View File

@@ -1,7 +1,7 @@
% create a vector with a random numbers
% create a vector with random numbers
x = rand(1000000, 1);
fprintf('time needed to manually filter elements smaller than 0.5 in a vector of length %i\n', length(x))
fprintf('Time needed to manually filter out elements smaller than 0.5 in a vector of length %i\n', length(x))
tic
results = [];
@@ -14,7 +14,7 @@ for i = 1:length(x)
end
toc
fprintf('\ntime needed to do the same with logical indexing\n')
fprintf('\nTime needed to do the same with logical indexing\n')
tic
results = x(x < 0.5);

View File

@@ -1,6 +1,6 @@
>> logicalIndexingBenchmark
time needed to manually filter elements smaller than 0.5 in a vector of length 100000
Time needed to manually filter elements smaller than 0.5 in a vector of length 100000
Elapsed time is 0.008562 seconds.
time needed to do the same with logical indexing
Time needed to do the same with logical indexing
Elapsed time is 0.001543 seconds.