Which physical change occurs when matter gives off thermal energy?