How do I calculate norm with a for loop?
Afficher commentaires plus anciens
So I have a set of data in a matrix represented as x y coordinates and another set of data as well with the same column dimensions but different row dimensions. How can I create a for loop to take the norm of each data point from each matrix to get the distance between every single coordinate point? In other words say I have matrix A= [1 2; 3 4; 5 6] and B = [9 8; 7 6; 5 4; 3 2; 1 0] where I want to take the norm of 1,2 and 9,8, 1,2 and 7,6 1,2 and 5,4 and so on.
Réponses (1)
Matt J
le 2 Mai 2022
pdist2(A,B)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!