Given two points in a Cartesian coordinate system, find the x-value on the line y = m*x+b where the y-value is equal to a given value c.
e.g.: we have the points P1(1,2) and P2(3,6) and we want wo know at which x-value y is equal to c = 8; The input is: x = [1 3], y = [2,6], c = 8.
The answer is 4.
Consider the possibility that there isn't any solution (return NaN) of that there is an infinity amount of points (return Inf). Additionally consider that the point could represent a vertial line.
Good Luck!

Solution Stats

91 Solutions

31 Solvers

Last Solution submitted on May 27, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers31

Suggested Problems

Problem Tags

Community Treasure Hunt

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

Start Hunting!