More matlab samples

This commit is contained in:
Joshua Peek
2012-06-21 10:44:31 -05:00
parent 497da86262
commit 540f2a0941
3 changed files with 135 additions and 23 deletions

9
test/fixtures/matlab/average.m vendored 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);