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

📄 subsref.html

📁 Robot tool box - provides many functions that are useful in robotics including such things as kinem
💻 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 subsref</title>  <meta name="keywords" content="subsref">  <meta name="description" content="SUBSREF Reference methods on a QUATERNION object">  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">  <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="#">@quaternion</a> &gt; subsref.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 ./@quaternion&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>--><h1>subsref</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>SUBSREF Reference methods on a QUATERNION object</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 v = subsref(q, s) </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">SUBSREF Reference methods on a QUATERNION object    QUATERNION.d        return a 4-vector of quaternion elements    QUATERNION.s        return the scalar component    QUATERNION.v        return the vector component    QUATERNION.t        return a 4x4 homogeneous transform    QUATERNION.r        return a 3x3 orthonormal rotation matrix</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="char.html" class="code" title="function s = char(q)">char</a>	CHAR Create string representation of quaternion object</li><li><a href="double.html" class="code" title="function v = double(q)">double</a>	DOUBLE Convert a quaternion object to a 4-element vector</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 t = q2tr(q)</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 <span class="comment">%SUBSREF Reference methods on a QUATERNION object</span>0002 <span class="comment">%</span>0003 <span class="comment">%    QUATERNION.d        return a 4-vector of quaternion elements</span>0004 <span class="comment">%    QUATERNION.s        return the scalar component</span>0005 <span class="comment">%    QUATERNION.v        return the vector component</span>0006 <span class="comment">%    QUATERNION.t        return a 4x4 homogeneous transform</span>0007 <span class="comment">%    QUATERNION.r        return a 3x3 orthonormal rotation matrix</span>0008 0009 <span class="comment">% Copyright (C) 1999-2008, by Peter I. Corke</span>0010 <span class="comment">%</span>0011 <span class="comment">% This file is part of The Robotics Toolbox for Matlab (RTB).</span>0012 <span class="comment">%</span>0013 <span class="comment">% RTB is free software: you can redistribute it and/or modify</span>0014 <span class="comment">% it under the terms of the GNU Lesser General Public License as published by</span>0015 <span class="comment">% the Free Software Foundation, either version 3 of the License, or</span>0016 <span class="comment">% (at your option) any later version.</span>0017 <span class="comment">%</span>0018 <span class="comment">% RTB is distributed in the hope that it will be useful,</span>0019 <span class="comment">% but WITHOUT ANY WARRANTY; without even the implied warranty of</span>0020 <span class="comment">% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>0021 <span class="comment">% GNU Lesser General Public License for more details.</span>0022 <span class="comment">%</span>0023 <span class="comment">% You should have received a copy of the GNU Leser General Public License</span>0024 <span class="comment">% along with RTB.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>0025 0026 <a name="_sub0" href="#_subfunctions" class="code">function v = subsref(q, s)</a>0027     <span class="keyword">if</span> s(1).type  == <span class="string">'.'</span>0028 0029         <span class="comment">% NOTE WELL:  the following code can't use getfield() since</span>0030         <span class="comment">% getfield()  uses this, and Matlab will crash!!</span>0031 0032         el = <a href="char.html" class="code" title="function s = char(q)">char</a>(s(1).subs);0033         <span class="keyword">switch</span> el,0034         <span class="keyword">case</span> <span class="string">'d'</span>,0035             v = <a href="double.html" class="code" title="function v = double(q)">double</a>(q);0036         <span class="keyword">case</span> <span class="string">'s'</span>,0037             v = q.s;0038         <span class="keyword">case</span> <span class="string">'v'</span>,0039             v = q.v;0040         <span class="keyword">case</span> <span class="string">'t'</span>,0041             v = <a href="#_sub1" class="code" title="subfunction t = q2tr(q)">q2tr</a>(q);0042         <span class="keyword">case</span> <span class="string">'r'</span>,0043             v = <a href="#_sub1" class="code" title="subfunction t = q2tr(q)">q2tr</a>(q);0044             v = v(1:3,1:3);0045         <span class="keyword">end</span>0046     <span class="keyword">else</span>0047         error(<span class="string">'only .field supported'</span>)0048     <span class="keyword">end</span>0049 0050 <span class="comment">%Q2TR    Convert unit-quaternion to homogeneous transform</span>0051 <span class="comment">%</span>0052 <span class="comment">%    T = q2tr(Q)</span>0053 <span class="comment">%</span>0054 <span class="comment">%    Return the rotational homogeneous transform corresponding to the unit</span>0055 <span class="comment">%    quaternion Q.</span>0056 <span class="comment">%</span>0057 <span class="comment">%    See also: TR2Q</span>0058 0059 <span class="comment">%    Copyright (C) 1993 Peter Corke</span>0060 <a name="_sub1" href="#_subfunctions" class="code">function t = q2tr(q)</a>0061 0062     q = <a href="double.html" class="code" title="function v = double(q)">double</a>(q);0063     s = q(1);0064     x = q(2);0065     y = q(3);0066     z = q(4);0067 0068     r = [    1-2*(y^2+z^2)    2*(x*y-s*z)    2*(x*z+s*y)0069         2*(x*y+s*z)    1-2*(x^2+z^2)    2*(y*z-s*x)0070         2*(x*z-s*y)    2*(y*z+s*x)    1-2*(x^2+y^2)    ];0071     t = eye(4,4);0072     t(1:3,1:3) = r;0073     t(4,4) = 1;</pre></div><hr><address>Generated on Sun 15-Feb-2009 18:09:29 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 + -