added fitting code to example2D.m