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

Problem 264. Find the "ordinary" or Euclidean distance between A and Z

Created by Bruce Raine

A, B and Z define three points in the 3D Euclidean space of the form: A = [x1;y1;0]; B = [x2;y2;0]; Z = [x2;y2;z];

Find the Euclidean distance between A and Z where

A = [1,0,0]; B = [5,3,0]; Z=[5,3,3];
>> euclidean(A,B,Z)
ans = 5.830951894845301

Your function should be able to handle 1 x 3 vectors or 3 x 1 vectors for all input parameters: A,B and Z. Z need not be 1 x 3 if A and B are. So 1x3,1x3,3x1 inputs, corresponding A, B and Z, are possible function input vectors.

HINT: use the Pythagorean formula.

Problem Group

Solution Statistics

90 correct solutions 31 incorrect solutions
Last solution submitted on Sep 26, 2014

Problem Comments

Solution Comments