reimplement plot_3d.m (forgot to push); remove some debugging print statements