?? disteu.m
字號:
%計算任意兩矢量的歐式距離function d = disteu(x, y)% Input:% x, y: 輸入矢量.%% Output:% d: 兩個輸入矢量的歐氏距離%% Note:% 歐氏距離公式: D = sum((x-y).^2).^0.5[M, N] = size(x);[M2, P] = size(y); if (M ~= M2) error('Matrix dimensions do not match.')endd = zeros(N, P);copies = zeros(1,P);for n = 1:N d(n,:) = sum((x(:, n+copies) - y) .^2, 1);end d = d.^0.5;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -