Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
perpendicular line

Subject: perpendicular line

From: Saiful

Date: 16 Sep, 2009 06:34:03

Message: 1 of 4

Hi,

How can I draw a perpendicular line from the mid-point of another line?

Appreciate your help,

Thanks and regards,
KSI

Subject: perpendicular line

From: Darren Rowland

Date: 16 Sep, 2009 06:59:02

Message: 2 of 4

KSI,
You can adapt the following to your specific needs

x = rand(1,2);
y = rand(1,2);
line(x,y)
% Slope of current line
m = (diff(y)/diff(x));
% Slope of new line
minv = -1/m;
line([mean(x) mean(x)+0.5],[mean(y) mean(y)+0.5*minv],'Color','red')
axis equal

Hth,
Darren

Subject: perpendicular line

From: Jos

Date: 16 Sep, 2009 07:38:02

Message: 3 of 4

"Saiful " <esaiful@gmail.com> wrote in message <h8q0sr$3mr$1@fred.mathworks.com>...
> Hi,
>
> How can I draw a perpendicular line from the mid-point of another line?
>
> Appreciate your help,
>
> Thanks and regards,
> KSI

Google -->
http://www.purplemath.com/modules/midpoint.htm

Jos

Subject: perpendicular line

From: Shivakumar

Date: 27 Aug, 2013 08:39:06

Message: 4 of 4

How can I get the normal to the line and not from the midpoint?

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us