matlab code for underdamped system