% factorial.m: Computes n factorial. function [nfact] = factorial(n) nfact = n; for i=n-1:-1:2, nfact = nfact*i; end;