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

Learn moreOpportunities for recent engineering grads.

Apply TodayGiven 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

62 correct solutions
53 incorrect solutions

Last solution submitted on Nov 12, 2014

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