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

📄 getidm.m

📁 这是用matlab编写的有关动态规划算法中回溯的实现
💻 M
字号:
function [IDM,ipcpdata]=getidm(pcpdata,flag)
m=size(pcpdata,2);
n=m-1;
ipcpdata=zeros(2,n);
for i=1:n
    h=30;
    for j=1:12
        pr=rotateright(pcpdata(:,i+1),2*(j-1));
        hj=cosdist(pcpdata(:,i),pr);
        if hj<h
          h=hj;   
          index=j;  
        end
    end
    ipcpdata(1,i)=index/12;%index from 1:12
    ipcpdata(2,i)=h;
end
IDM=zeros(n,n);
max=0;
for i=1:n
    for j=i:n
      IDM(i,j)=cosdist(ipcpdata(:,i),ipcpdata(:,j));
      if IDM(i,j)>max
          max=IDM(i,j);
      end
    end
end
IDM=IDM/max;
for i=1:n
    for j=1:i-1
      IDM(i,j)=IDM(j,i);
    end
end
if nargin==2
 if flag=='plot';
   imagesc(1-IDM);
   colormap(gray);
   colorbar;
 end
end

⌨️ 快捷键说明

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