Added plot of detection function