본문 바로가기
여러가지 노하우

Distance Matrix로부터 Coordinate 구하는 공식. 간단 테스트 코드

by 심심한공학박사 2024. 2. 25.

Distance Matrix로부터 Coordinate 구하는 공식. 간단 테스트 코드 

원본 출처,

 

%Finding the coordinates of points from distance matrix
%https://math.stackexchange.com/questions/156161/finding-the-coordinates-of-points-from-distance-matrix/423898#423898

Cooridnate =[0,0; 1,0; 1,1; 0,1]; 

D=zeros(4,4); 

for i =1:length(Cooridnate)
   for j =1:length(Cooridnate)

    D(i,j) = ( Cooridnate(i,1)- Cooridnate(j,1) )^2+ ( Cooridnate(i,2)- Cooridnate(j,2) )^2; 
    D(i,j) = sqrt(D(i,j)); 


   end
end

M=zeros(length(D),length(D)); 

for i =1:length(D)
    for j =1:length(D)

       M(i,j)  =( D(1,j)^2 + D(i,1)^2 -D(i,j)^2 ) * 0.5; 


    end
end

%[U,S,V]=svd(M); 

[V,d]= eig(M); 


% check M 
M1 = (V*d)*transpose(V);

X=V* real(sqrt(d));

'여러가지 노하우' 카테고리의 다른 글

SK텔레콤 해킹사태와 알뜰폰 쓰기  (1) 2025.04.29
How to Speak: Prof. Patrick Winston  (0) 2025.01.20
Cocalc 클라우드 컴퓨팅 플랫폼  (0) 2025.01.14
vim 노트  (0) 2025.01.13
Runge Kutta Method 실습 (1일차)  (1) 2024.02.22