Fixed matlab code for erin's second trial