Finished coding align_ibm1.m