Problem 1633. Find the right x in a 1. order Polynomal (y = m*x+c)
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
Problem Comments
-
5 Comments
Show
2 older comments
Dan
on 10 Jun 2013
I don't understand the meaning of the problem. If y=c then x=0. Enlighten me, please.
Carlos Adrian Vargas Aguilera
on 30 Jun 2013
If y=mx+b, when y=c, x=?
Martin
on 23 Jul 2013
Hi everyone:
Dan: in my mathematical understanding (correct me if I am wrong): if y=c the slope m of the curve is 0. but for all x the condition y = c is correct, so x should be infinite
Or is there some error in the solution?
Rafael S.T. Vieira
on 4 Oct 2020
The problem description needs to be improved, maybe to something like: Given two points in a Cartesian coordinate system, find the x-value on the line y = a*x+b in which the y-value is equal to a given value c.
goc3
on 8 Oct 2020
The description has been updated.
Solution Comments
Show commentsProblem Recent Solvers28
Suggested Problems
-
2288 Solvers
-
220 Solvers
-
717 Solvers
-
810 Solvers
-
4349 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!