https://devhubby.com/thread/how-to-find-intersect-of-two-curves-in-matlab