📄 slaccel.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 slaccel</title> <meta name="keywords" content="slaccel"> <meta name="description" content="SLACCEL S-function for robot acceleration"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="generator" content="m2html © 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> > <a href="#">simulink</a> > slaccel.m</div><!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td><td align="right"><a href="index.html">Index for ./simulink <img alt=">" border="0" src="../right.png"></a></td></tr></table>--><h1>slaccel</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2><div class="box"><strong>SLACCEL S-function for robot acceleration</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 [sys,x0,str,ts] = slaccel(t,x,u,flag, robot) </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">SLACCEL S-function for robot acceleration This is the S-function for computing robot acceleration. It assumes input data u to be the state vector [q qd]. Implemented as an S-function to get around vector sizing problem with Simulink 4.</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)"></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 [sys,x0,str,ts]=mdlInitializeSizes(robot)</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">%SLACCEL S-function for robot acceleration</span>0002 <span class="comment">%</span>0003 <span class="comment">% This is the S-function for computing robot acceleration. It assumes input</span>0004 <span class="comment">% data u to be the state vector [q qd].</span>0005 <span class="comment">%</span>0006 <span class="comment">% Implemented as an S-function to get around vector sizing problem with</span>0007 <span class="comment">% Simulink 4.</span>0008 0009 <a name="_sub0" href="#_subfunctions" class="code">function [sys,x0,str,ts] = slaccel(t,x,u,flag, robot)</a>0010 <span class="keyword">switch</span> flag,0011 0012 <span class="keyword">case</span> 00013 <span class="comment">% initialize the robot graphics</span>0014 [sys,x0,str,ts] = <a href="#_sub1" class="code" title="subfunction [sys,x0,str,ts]=mdlInitializeSizes(robot)">mdlInitializeSizes</a>(robot); <span class="comment">% Init</span>0015 0016 <span class="keyword">case</span> {3}0017 <span class="comment">% come here to calculate derivitives</span>0018 sys = accel(robot, u);0019 <span class="keyword">case</span> {1, 2, 4, 9}0020 sys = [];0021 <span class="keyword">end</span>0022 <span class="comment">%</span>0023 <span class="comment">%=============================================================================</span>0024 <span class="comment">% mdlInitializeSizes</span>0025 <span class="comment">% Return the sizes, initial conditions, and sample times for the S-function.</span>0026 <span class="comment">%=============================================================================</span>0027 <span class="comment">%</span>0028 <a name="_sub1" href="#_subfunctions" class="code">function [sys,x0,str,ts]=mdlInitializeSizes(robot)</a>0029 0030 <span class="comment">%</span>0031 <span class="comment">% call simsizes for a sizes structure, fill it in and convert it to a</span>0032 <span class="comment">% sizes array.</span>0033 <span class="comment">%</span>0034 <span class="comment">% Note that in this example, the values are hard coded. This is not a</span>0035 <span class="comment">% recommended practice as the characteristics of the block are typically</span>0036 <span class="comment">% defined by the S-function parameters.</span>0037 <span class="comment">%</span>0038 sizes = simsizes;0039 0040 sizes.NumContStates = 0;0041 sizes.NumDiscStates = 0;0042 sizes.NumOutputs = robot.n;0043 sizes.NumInputs = 3*robot.n;0044 sizes.DirFeedthrough = 1;0045 sizes.NumSampleTimes = 1; <span class="comment">% at least one sample time is needed</span>0046 0047 sys = simsizes(sizes);0048 0049 <span class="comment">%</span>0050 <span class="comment">% initialize the initial conditions</span>0051 <span class="comment">%</span>0052 x0 = [];0053 0054 <span class="comment">%</span>0055 <span class="comment">% str is always an empty matrix</span>0056 <span class="comment">%</span>0057 str = [];0058 0059 <span class="comment">%</span>0060 <span class="comment">% initialize the array of sample times</span>0061 <span class="comment">%</span>0062 ts = [0 0];0063 0064 <span class="comment">% end mdlInitializeSizes</span></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> © 2003</address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -