# find intersection points of a line and a curve.

102 views (last 30 days)

Show older comments

##### 0 Comments

### Accepted Answer

Adam Danz
on 20 Feb 2021

Edited: Adam Danz
on 20 Feb 2021

There are several ways to get the x values at each intersection of the y-value. The simplest solution is to use the intersections() function from the file exchange (I show a similar demo in this answer, "method #2").

That function will return the (x,y) coordinates of the intersection points. Use the x values to plot vertical lines using xline().

% x is a vector of x-values at each intersection

arrayfun(@xline,x)

Or, if you're more comfortable with for-loops,

for i = 1:numel(x)

xline(x(i))

end

### More Answers (0)

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!