How can I calculate the slope of a line given two points?
Show older comments
I need a function which can output the slope of a 2D line given two points. Ofcourse, I could just use m = (y2-y1)/(x2-x1), however, I have a long list of points/lines which I need to find the slope of and I don't believe this would be the most efficient method.
Something similar to the pdist2(point_a, point_b) function which I've previously used to find the distance between two points would be ideal.
Thanks in advance.
Accepted Answer
More Answers (1)
Neal Young
on 22 Feb 2015
0 votes
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!