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

📄 vecdist.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 vecdist</title>  <meta name="keywords" content="vecdist">  <meta name="description" content="VECDIST Distance between two set of vectors">  <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; vecdist.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>vecdist</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>VECDIST Distance between two set of vectors</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 distmat = vecdist(mat1, mat2) </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"> VECDIST Distance between two set of vectors
    VECDIST(MAT1, MAT2) returns the distance matrix between two
    set of vectors MAT1 and MAT2. The element at row i and column j
    of the return matrix is the Euclidean distance between row i
    of MAT1 and row j of MAT2.</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)"></ul>This function is called by:<ul style="list-style-image:url(../matlabicon.gif)"><li><a href="conddm.html" class="code" title="">conddm</a>	Demo of condensing technique for data reduction</li><li><a href="editdm.html" class="code" title="">editdm</a>	Demo of editing technique for data reduction</li><li><a href="fknn.html" class="code" title="function test_out = fknn(sample_in, sample_out, test_in, k, m)">fknn</a>	FKNN Fuzzy k-nearest neighbor classification rule</li><li><a href="initfknn.html" class="code" title="function fuz_class = initfknn(sampledata, k)">initfknn</a>	INITfknn Initialize fuzzy membership grades of sample output for fuzzy KNN.</li><li><a href="initkm2.html" class="code" title="function center_index = initkm2(distmat, cluster_n, method)">initkm2</a>	INITKM2 Find the initial centers for a K-means clustering algorithm.</li><li><a href="kmeans2.html" class="code" title="function [center_index, U, obj_fcn] = kmeans2(distmat, cluster_n, options)">kmeans2</a>	KMEANS Find clusters with Forgy's batch-mode k-means clustering.</li></ul><!-- crossreference --><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 distmat = vecdist(mat1, mat2)</a>0002 <span class="comment">% VECDIST Distance between two set of vectors</span>0003 <span class="comment">%    VECDIST(MAT1, MAT2) returns the distance matrix between two</span>0004 <span class="comment">%    set of vectors MAT1 and MAT2. The element at row i and column j</span>0005 <span class="comment">%    of the return matrix is the Euclidean distance between row i</span>0006 <span class="comment">%    of MAT1 and row j of MAT2.</span>0007 0008 <span class="comment">%    Roger Jang, Sept 24, 1996.</span>0009 0010 <span class="keyword">if</span> nargin == 1,0011     mat2 = mat1;0012 <span class="keyword">end</span>0013 0014 [m1, n1] = size(mat1);0015 [m2, n2] = size(mat2);0016 0017 <span class="keyword">if</span> n1 ~= n2,0018     error(<span class="string">'Matrices mismatch!'</span>);0019 <span class="keyword">end</span>0020 0021 distmat = zeros(m1, m2);0022 0023 <span class="keyword">if</span> n1 == 1,0024     distmat = abs(mat1*ones(1,m2)-ones(m1,1)*mat2');0025 <span class="keyword">elseif</span> m2 &gt;= m1,0026     <span class="keyword">for</span> i = 1:m1,0027         distmat(i,:) = sqrt(sum(((ones(m2,1)*mat1(i,:)-mat2)').^2));0028     <span class="keyword">end</span>0029 <span class="keyword">else</span> 0030     <span class="keyword">for</span> i = 1:m2,0031         distmat(:,i) = sqrt(sum(((mat1-ones(m1,1)*mat2(i,:))').^2))';0032     <span class="keyword">end</span>0033 <span class="keyword">end</span></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 + -