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

📄 dtw3.html

📁 一个关于数据聚类和模式识别的程序,在生物化学,化学中因该都可以用到.希望对大家有用,谢谢支持
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"                "http://www.w3.org/TR/REC-html40/loose.dtd"><html><head>  <title>Description of dtw3</title>  <meta name="keywords" content="dtw3">  <meta name="description" content="dtw2: Dynamic time warping with local paths of 0 and 45 degrees, presumably for the comparison of music mid vector to note vector">  <meta http-equiv="Content-Type" content="text/html; charset=big5">  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">  <meta name="robots" content="index, follow">  <link type="text/css" rel="stylesheet" href="../m2html.css"></head><body><a name="_top"></a><div><a href="../index.html">Home</a> &gt;  <a href="index.html">dcpr</a> &gt; dtw3.m</div><!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td><td align="right"><a href="index.html">Index for dcpr&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>--><h1>dtw3</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>dtw2: Dynamic time warping with local paths of 0 and 45 degrees, presumably for the comparison of music mid vector to note vector</strong></div><h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>function [minDist, dtwPath, dtwTable]=dtw3(vec1, vec2, beginCorner, endCorner, plotOpt) </strong></div><h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre class="comment"> dtw2: Dynamic time warping with local paths of 0 and 45 degrees, presumably for the comparison of music mid vector to note vector
    Usage: [minDist, dtwPath, dtwTable] = dtw3(vec1, vec2, beginCorner, endCorner, plotOpt)
        vec1: testing vector
        vec2: reference vector
        beginCorner: 1 for anchored beginning
        endCorner: 1 for anchored ending
        plotOpt: 1 for plotting the DTW path
        minDist: minimun distance of DTW
        dtwPath: optimal path of DTW (Its size is 2xk, where k is the path length.)
        dtwTable: DTW table

    Type &quot;dtw1&quot; for a self-demo.</pre></div><!-- crossreference --><h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>This function calls:<ul style="list-style-image:url(../matlabicon.gif)"><li><a href="dtwPlot.html" class="code" title="function dtwplot(vec1, vec2, DTWpath, DTWpath2)">dtwPlot</a>	DTWPLOT Plot the result of DTW of two pitch/MFCC vectors</li></ul>This function is called by:<ul style="list-style-image:url(../matlabicon.gif)"></ul><!-- crossreference --><h2><a name="_subfunctions"></a>SUBFUNCTIONS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><ul style="list-style-image:url(../matlabicon.gif)"><li><a href="#_sub1" class="code">function selfdemo</a></li></ul><h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [minDist, dtwPath, dtwTable]=dtw3(vec1, vec2, beginCorner, endCorner, plotOpt)</a>0002 <span class="comment">% dtw2: Dynamic time warping with local paths of 0 and 45 degrees, presumably for the comparison of music mid vector to note vector</span>0003 <span class="comment">%    Usage: [minDist, dtwPath, dtwTable] = dtw3(vec1, vec2, beginCorner, endCorner, plotOpt)</span>0004 <span class="comment">%        vec1: testing vector</span>0005 <span class="comment">%        vec2: reference vector</span>0006 <span class="comment">%        beginCorner: 1 for anchored beginning</span>0007 <span class="comment">%        endCorner: 1 for anchored ending</span>0008 <span class="comment">%        plotOpt: 1 for plotting the DTW path</span>0009 <span class="comment">%        minDist: minimun distance of DTW</span>0010 <span class="comment">%        dtwPath: optimal path of DTW (Its size is 2xk, where k is the path length.)</span>0011 <span class="comment">%        dtwTable: DTW table</span>0012 <span class="comment">%</span>0013 <span class="comment">%    Type &quot;dtw1&quot; for a self-demo.</span>0014 0015 <span class="comment">%    Roger Jang, 20060529, 20060614</span>0016 0017 <span class="keyword">if</span> nargin&lt;1, <a href="#_sub1" class="code" title="subfunction selfdemo">selfdemo</a>; <span class="keyword">return</span>; <span class="keyword">end</span>0018 <span class="keyword">if</span> nargin&lt;3, beginCorner=1; <span class="keyword">end</span>0019 <span class="keyword">if</span> nargin&lt;4, endCorner=1; <span class="keyword">end</span>0020 <span class="keyword">if</span> nargin&lt;5, plotOpt=0; <span class="keyword">end</span>0021 0022 <span class="comment">% If input is vector, make it row vector</span>0023 <span class="keyword">if</span> size(vec1,1)==1 | size(vec1,2)==1, vec1 = vec1(:)'; <span class="keyword">end</span>0024 <span class="keyword">if</span> size(vec2,1)==1 | size(vec2,2)==1, vec2 = vec2(:)'; <span class="keyword">end</span>0025 0026 <span class="keyword">if</span> nargout&lt;20027     minDist=dtw3mex(vec1, vec2, beginCorner, endCorner);0028 <span class="keyword">else</span>0029     [minDist, dtwPath, dtwTable]=dtw3mex(vec1, vec2, beginCorner, endCorner);0030 <span class="keyword">end</span>0031 0032 <span class="comment">% Plotting if necessary</span>0033 <span class="keyword">if</span> plotOpt==1, dtwplot(vec1, vec2, dtwPath); <span class="keyword">end</span>0034 0035 0036 <span class="comment">% ====== Self demo</span>0037 <a name="_sub1" href="#_subfunctions" class="code">function selfdemo</a>0038 pv=[47.485736 48.330408 48.917323 49.836778 50.478049 50.807818 50.478049 50.807818 50.478049 49.836778 50.154445 49.836778 50.154445 50.478049 49.524836 52.930351 52.930351 52.930351 52.558029 52.193545 51.836577 51.836577 51.836577 52.558029 52.558029 52.930351 52.558029 52.193545 51.836577 51.486821 49.218415 48.330408 48.621378 48.917323 49.836778 50.478049 50.478049 50.154445 50.478049 50.807818 50.807818 50.154445 50.154445 50.154445 54.505286 55.349958 55.349958 55.788268 55.788268 55.788268 55.788268 55.788268 55.788268 55.788268 55.788268 55.349958 55.349958 54.505286 54.505286 54.922471 55.788268 55.788268 56.237965 55.788268 55.349958 55.349958 55.349958 55.349958 55.349958 55.349958 55.349958 55.349958 55.349958 55.349958 54.922471 54.922471 54.097918 49.218415 49.218415 48.917323 49.218415 49.836778 50.478049 50.478049 50.154445 49.836778 50.154445 49.524836 49.836778 49.524836 55.788268 53.699915 53.699915 53.310858 53.310858 53.310858 53.310858 52.930351 52.930351 52.930351 52.930351 52.930351 52.558029 52.193545 51.486821 50.154445 49.836778 49.836778 50.154445 50.478049 50.478049 50.154445 49.836778 49.836778 49.524836 49.524836 49.524836 56.699654 57.661699 58.163541 58.163541 57.661699 57.661699 57.661699 57.661699 57.661699 57.661699 57.661699 57.661699 58.163541 57.173995 56.699654 56.237965 55.788268 56.237965 56.699654 56.699654 56.237965 55.788268 56.237965 56.237965 56.237965 56.237965 56.237965 56.237965 56.237965 55.788268 54.097918 50.154445 50.154445 50.478049 51.143991 51.143991 50.807818 50.154445 51.143991 50.154445 50.478049 50.807818 50.478049 60.330408 61.524836 62.154445 62.807818 62.807818 62.807818 62.807818 62.807818 63.486821 63.486821 63.486821 63.486821 62.807818 62.807818 61.524836 59.213095 58.163541 58.680365 59.213095 59.762739 59.762739 59.762739 59.762739 59.762739 59.762739];0039 note=[60 29 60 10 62 38 60 38 65 38 64 77 60 29 60 10 62 38 60 38 67 38 65 77 60 29 60 10 72 38 69 38 65 38 64 38 62 77 0 77 70 29 70 10 69 38 65 38 67 38 65 38];0040 pv=pv+13;0041 notePitch=note(1:2:end);    <span class="comment">% ?u????

⌨️ 快捷键说明

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