No BSD License  

Highlights from
An Introduction to Stochastic Processes

image thumbnail
[gcd]=mc_GCD(a,b)
function [gcd]=mc_GCD(a,b)
%
%    Finding the greatest common divisor of "a" and "b"
%    Euclid's algorithm
%    
m=min(abs(a),abs(b)); M=max(abs(a),abs(b));
if m == 0, gcd=M; return, end; z = 1;
while z ~= 0
      z=rem(M,m); if z == 0, gcd = m; return, end; M = m; m = z;
end

Contact us at files@mathworks.com