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

📄 getsquareddist.m

📁 Continuous Profile Models (CPM) Matlab Toolbox.
💻 M
字号:
%% function d=getSquaredDist(t,r)%%%% distance function used with DTW function such as dp.m dp2.m and dpJenn.m%%%% assumes that t and r have dimension: [length x numDims]%% the squared distance is the sum of the squared differences across%% all dimensions at one time pointfunction x=getSquaredDist(t,r)%% CHANGES BY JENN:[N D]=size(t); [M D]=size(r);x=zeros(N,M);%% accumulate over each dimensionfor d=1:D    x = x + (repmat(t(:,d),1,M)-repmat(r(:,d)',N,1)).^2;endx=x/D;return%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% original code that I got from web[rows,N]=size(t); [rows,M]=size(r);%for n=1:N%    for m=1:M%        d(n,m)=(t(n)-r(m))^2;%    end%end%this replaces the nested for loops from above Thanks Georg Schmitz d=(repmat(t(:),1,M)-repmat(r(:)',N,1)).^2;

⌨️ 快捷键说明

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