function y = findmax(x) % % y = findmax(x) returns the maximum value % in the array x % y = x(1); for i = 2:length(x) if x(i) > y y = x(i); end; end;