Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7875331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:57:55+00:00 2026-06-03T02:57:55+00:00

I have a matrix A (Mx2), and matrix B (Nx2), with M>=N. I have

  • 0

I have a matrix A (Mx2), and matrix B (Nx2), with M>=N.
I have to compute the perpendicular euclidean distance to test similarity between A and B. Refering to the image, a single euclidean distance is the segment between each pi and p’i, once computed every single perpendicular distance, I can compute the mean or the sum to get a single parameter. Do you know a matlab routine or such a script that do this?
enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:57:56+00:00Added an answer on June 3, 2026 at 2:57 am

    If you know that p1 .. p4 lie between p0 and p5, then you can use the area of a triangle to calculate the perpendicular distance easily:

    d(p0p5, p1) = 2 * area(p0p1p5) / norm(p5-p0)
    

    The area of a triangle is found by

    area(p0p1p5) = sqrt(s * (s-norm(p0-p1)) * (s-norm(p1-p5)) * (s-norm(p5-p0)))
    

    where

    s = (norm(p0-p1) + norm(p1-p5) + norm(p5-p0)) / 2
    

    I think you can gain a performance improvement using the dot product for projection and pythagorean theorem:

    d(p0p5, p1) = sqrt(norm(p1-p0)^2 - dot(p1-p0,p5-p0)^2/norm(p5-p0)^2)
    

    In either case, if your cost function involves mean-squared error, you can eliminate the sqrt call by just evaluating the squared-error instead. Norm-squares are also cheaper to calculate than calling norm and then squaring (use a dot product instead).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this matrix A, representing similarities of pixel intensities of an image. For
I have a matrix (32X48). How can I convert the matrix into a single
I have a matrix x of size Nx2 (contains (x,y) coordinates) and a matrix
Have a matrix report now that has Position, Hours and Wages for a location
I have a matrix in the type of a Numpy array. How would I
I have the matrix system: A x B = C A is a by
I have a matrix in MATLAB and I need to find the 99% value
I have a matrix A consisting of 200 vectors of size d. I want
I have a matrix: mat = [ 2009 3 ; 2010 2 ] ;
I have NxM matrix with integer elements, greater or equal than 0. From any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.