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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Given a point, P(x,y), find the distance from this point to a linear line.

INPUTS: x, y, A, B, C

OUTPUTS: d, the distance which of course should always be positive.

EX: >>x=2; y=2; A=2; B=2; C=-4; >>d = normalLen(x,y,A,B,C) d = 1.4142

65 correct solutions
55 incorrect solutions

Last solution submitted on Feb 13, 2015

1 Comment

Alfonso Nieto-Castanon
on 25 Jan 2013

note: this is the wrong formula (x=0;y=12345;A=0;B=1;C=0 should return 12345, not 1...)

1 Comment

Peter Wittenberg
on 2 Sep 2012

Come on, Amitava - you don't need to game the solution.

1 Comment