3D Segment Project in Matlab