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

📄 dtw1.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 dtw1</title>  <meta name="keywords" content="dtw1">  <meta name="description" content="dtw1: Dynamic time warping with local paths of 27, 45, and 63 degrees">  <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; dtw1.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>dtw1</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>dtw1: Dynamic time warping with local paths of 27, 45, and 63 degrees</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] = dtw1(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"> dtw1: Dynamic time warping with local paths of 27, 45, and 63 degrees
    Usage: [minDist, dtwPath, dtwTable] = dtw1(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

    For example:
        vec1=[71 73 75 80 80 80 78 76 75 73 71 71 71 73 75 76 76 68 76 76 75 73 71 70 70 69 68 68 72 74 78 79 80 80 78];
        vec2=[69 69 73 75 79 80 79 78 76 73 72 71 70 70 69 69 69 71 73 75 76 76 76 76 76 75 73 71 70 70 71 73 75 80 80 80 78];
        [minDist, dtwPath, dtwTable] = dtw1(vec1, vec2);
        dtwplot(vec1, vec2, dtwPath);</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="dtw1.html" class="code" title="function [minDist, dtwPath, dtwTable] = dtw1(vec1, vec2, beginCorner, endCorner, plotOpt)">dtw1</a>	dtw1: Dynamic time warping with local paths of 27, 45, and 63 degrees</li></ul>This function is called by:<ul style="list-style-image:url(../matlabicon.gif)"><li><a href="dtw1.html" class="code" title="function [minDist, dtwPath, dtwTable] = dtw1(vec1, vec2, beginCorner, endCorner, plotOpt)">dtw1</a>	dtw1: Dynamic time warping with local paths of 27, 45, and 63 degrees</li><li><a href="dtwPlot2.html" class="code" title="function dtwplot2(vec1, vec2, dtwPath)">dtwPlot2</a>	dtwPlot2: Plot the result of DTW of two pitch/MFCC vectors</li><li><a href="dtwPlot3.html" class="code" title="function dtwplot2(vec1, vec2, dtwPath)">dtwPlot3</a>	dtwPlot2: Plot the result of DTW of two pitch/MFCC vectors</li></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] = dtw1(vec1, vec2, beginCorner, endCorner, plotOpt)</a>0002 <span class="comment">% dtw1: Dynamic time warping with local paths of 27, 45, and 63 degrees</span>0003 <span class="comment">%    Usage: [minDist, dtwPath, dtwTable] = dtw1(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">%    For example:</span>0014 <span class="comment">%        vec1=[71 73 75 80 80 80 78 76 75 73 71 71 71 73 75 76 76 68 76 76 75 73 71 70 70 69 68 68 72 74 78 79 80 80 78];</span>0015 <span class="comment">%        vec2=[69 69 73 75 79 80 79 78 76 73 72 71 70 70 69 69 69 71 73 75 76 76 76 76 76 75 73 71 70 70 71 73 75 80 80 80 78];</span>0016 <span class="comment">%        [minDist, dtwPath, dtwTable] = dtw1(vec1, vec2);</span>0017 <span class="comment">%        dtwplot(vec1, vec2, dtwPath);</span>0018 0019 <span class="comment">%    Roger Jang, 20021225, 20060614</span>0020 0021 <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>0022 <span class="keyword">if</span> nargin&lt;3, beginCorner=1; <span class="keyword">end</span>0023 <span class="keyword">if</span> nargin&lt;4, endCorner=1; <span class="keyword">end</span>0024 <span class="keyword">if</span> nargin&lt;5, plotOpt=0; <span class="keyword">end</span>0025 0026 <span class="comment">% If input is vector, make it row vector</span>0027 <span class="keyword">if</span> size(vec1,1)==1 | size(vec1,2)==1, vec1 = vec1(:)'; <span class="keyword">end</span>0028 <span class="keyword">if</span> size(vec2,1)==1 | size(vec2,2)==1, vec2 = vec2(:)'; <span class="keyword">end</span>0029 0030 <span class="keyword">if</span> nargout&lt;20031     minDist=dtw1mex(vec1, vec2, beginCorner, endCorner);0032 <span class="keyword">else</span>0033     [minDist, dtwPath, dtwTable]=dtw1mex(vec1, vec2, beginCorner, endCorner);0034 <span class="keyword">end</span>0035 0036 <span class="comment">% Plotting if necessary</span>0037 <span class="keyword">if</span> plotOpt==1, dtwplot(vec1, vec2, dtwPath); <span class="keyword">end</span>0038 0039 <span class="comment">% ====== Self demo</span>0040 <a name="_sub1" href="#_subfunctions" class="code">function selfdemo</a>0041 vec1=[71 73 75 80 80 80 78 76 75 73 71 71 71 73 75 76 76 68 76 76 75 73 71 70 70 69 68 68 72 74 78 79 80 80 78];0042 vec2=[69 69 73 75 79 80 79 78 76 73 72 71 70 70 69 69 69 71 73 75 76 76 76 76 76 75 73 71 70 70 71 73 75 80 80 80 78];0043 [minDist, dtwPath, dtwTable] = <a href="dtw1.html" class="code" title="function [minDist, dtwPath, dtwTable] = dtw1(vec1, vec2, beginCorner, endCorner, plotOpt)">dtw1</a>(vec1, vec2);0044 dtwplot(vec1, vec2, dtwPath);</pre></div><hr><address>Generated on Thu 30-Oct-2008 12:53:56 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address></body></html>

⌨️ 快捷键说明

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