Mechatronics: 3D Curve fitting with MATLAB