Program to calculate Distance between points and fixed point

I have three points A(000),B(111),C(222) and one fixed position P(333). I want make program to calculate the distance from A, B and C to point P using for loops. Appreciate if have some idea?

 Réponse acceptée

Use pdist2
distances=pdist2([A;B;C],P)

4 commentaires

Appreciate your answer. But I was given task using for loop I need the above point A,B and C in single array and from these points i have to calculate distance to fixed point P using for loop.
pdist2.m has for-loops inside it.
Thank you. And can angle made by A,B,C to P be calculated using these distances and these points or distances?
No, they cannot.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by