Adding matlab code from which tcaR will be principally derived.