linecirc gives the intersection points of a line and a circle.
[xout,yout] = linecirc(slope,intercpt,centerx,centery,radius);
This function finds the points of intersection given a circle defined by a center and radius in x-y coordinates, and a line defined by slope and y-intercept, or a slope of “inf” and an x-intercept. Two points are returned. When the objects do not intersect, NaNs are returned.
When the line is tangent to the circle, two identical points are returned. All inputs must be scalars.
[xout, yout] = linecirc(-1,3,0,0,5);
This will give the intersection point of line and circle .