Move test fixtures to samples/

This commit is contained in:
Joshua Peek
2012-06-22 10:09:24 -05:00
parent b571c47a1c
commit 5521dd08a0
247 changed files with 13 additions and 14 deletions

9
samples/matlab/average.m Normal file
View File

@@ -0,0 +1,9 @@
function y = average(x)
% AVERAGE Mean of vector elements.
% AVERAGE(X), where X is a vector, is the mean of vector
% elements. Nonvector input results in an error.
[m,n] = size(x);
if (~((m == 1) | (n == 1)) | (m == 1 & n == 1))
error('Input must be a vector')
end
y = sum(x)/length(x);