⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mds.m

📁 best routing protocol
💻 M
字号:
% MDS based on distance matrix ALGORITHM%% function [Y,eigenvals] = dist_pca(D, dim)%% D = distance as N x N matrix ( N = #points)% dim = embedding dimensionality% y = embedding as  N x dim matrixfunction [y,eigenvals] = mds(D,dim)    S = D.^2; %the squared distance    N = length(S);    g = gramMatrix(S);    [mu, lam] = eig(g);    eigenvals = dot(lam,eye(N));    rep_lam = repmat(eigenvals(N-dim+1:N),N,1);    new_mu = mu(:,N-dim+1:N); % last d col of  mu    y = sqrt(rep_lam).*new_mu;    function g = gramMatrix(s)%s is the squared distance matrix    N = length(s);    over_i = sum(s);    total = sum(over_i);    Gjj = (over_i - total/N/2) / N;    rep_Gjj = repmat(Gjj,N,1);    rep_Gii = rep_Gjj';    g = (rep_Gjj+rep_Gii-s)./2;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -