1. compile TVreg.c
type the following command in matlab command window:
mex TVreg.c

2. run Demo.m
