Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Problem 1633. Find the right x in a 1. order Polynomal (y = m*x+c)

Created by Martin

Given two points in a Cartesian coordinate system, find the x-value, where polynomial of 1. order (y = m*x+c) 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!


Problem Group

Solution Statistics

18 correct solutions 24 incorrect solutions
Last solution submitted on Apr 28, 2015

Problem Comments

Solution Comments