Bac1 project code in matlab