File: step.htm

package info (click to toggle)
extrema 4.3.6-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 19,212 kB
  • ctags: 6,452
  • sloc: cpp: 86,428; sh: 8,229; makefile: 814
file content (88 lines) | stat: -rw-r--r-- 3,389 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<HTML>
<HEAD>
<TITLE>STEP</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF" fgcolor="#000000">

<P><A NAME="step"></A>
<font size="+3" color="green"><B>STEP</B></font></P>
<P>
<TABLE border="1" cols="2" frame="box" rules="all" width="572">
<TR>
<TD width="15%" valign="top"><B>Syntax</B>:</TD>
<TD width="85%"><CODE>
vector = STEP( vector, scalar )<br />
matrix = STEP( matrix, scalar )</CODE>
</TD></TR>
</table></p>
<p>
 The <CODE>STEP</CODE> function accepts either a vector or a matrix
 as its first argument. It shifts the elements of a vector or the rows of a matrix by the
 specified step size, the scalar second argument.</p>
<P>
 Suppose the step size is <i>n</i>.</P>
<P>
 <table>
 <tr>
 <td valign="top">&bull;</td><td>If <i>n</i> &gt; 0, the last <i>n</i> elements of the vector or
 the last <i>n</i> rows of the matrix are lost.</td>
 </tr><tr>
 <td valign="top">&bull;</td><td>If <i>n</i> = 0, the vector or matrix is returned unchanged.</td>
 </tr><tr>
 <td valign="top">&bull;</td><td>If <i>n</i> &lt; 0, the first <i>n</i> elements of the vector
 or the first <i>n</i> rows of the matrix are lost.</td>
 </tr></table></P>
<P>
 If the step size is not an integer, then linear interpolation is used to generate new
 values.</P>
<P>
 <font size="+1" color="green">Examples</font></P>
<P>
 <table>
 <tr>
 <td bgcolor="#FFCCCC"><i>function</i></td><td bgcolor="#FFCCCC"><i>result</i></td>
 </tr><tr>
 <td><CODE><font color="blue">STEP([1:10],2)</font></CODE></td>
 <td bgcolor="#FFFFCC"><CODE>[1;1;1;2;3;4;5;6;7;8]</CODE></td>
 </tr><tr>
 <td><CODE><font color="blue">STEP([1:10],-2)</font></CODE></td>
 <td bgcolor="#FFFFCC"><CODE>[3;4;5;6;7;8;9;10;10;10]</CODE></td>
 </tr><tr>
 <td><CODE><font color="blue">STEP([1:10],1.7)</font></CODE></td>
 <td bgcolor="#FFFFCC"><CODE>[1;1;1.3;2.3;3.3;4.3;5.3;6.3;7.3;8.3]</CODE></td>
 </tr></table></P>
<P>
 Suppose you have a matrix <CODE>M</CODE><br />
 <pre>
            | 1  2  3  4 |
        M = | 5  6  7  8 |
            | 9 10 11 12 |
 </pre></P>
<P>
 <table>
 <tr>
 <td bgcolor="#FFCCCC"><i>function</i></td><td bgcolor="#FFCCCC"><i>result</i></td>
 </tr><tr>
 <td valign="middle"><CODE><font color="blue">STEP(M,2)</font></CODE></td>
 <td bgcolor="#FFFFCC"><table cellspacing="0"><tr><td><CODE>| 1 2 3 4 |</CODE></td></tr>
            <tr><td><CODE>| 1 2 3 4 |</CODE></td></tr>
            <tr><td><CODE>| 1 2 3 4 |</CODE></td></tr></table></td>
 </tr><tr><td></td><td></td></tr><tr>
 <td valign="middle"><CODE><font color="blue">STEP(M,-1)</font></CODE></td>
 <td bgcolor="#FFFFCC"><table cellspacing="0"><tr><td><CODE>| 5&nbsp; 6&nbsp; 7&nbsp; 8 |</CODE></td></tr>
            <tr><td><CODE>| 9 10 11 12 |</CODE></td></tr>
            <tr><td><CODE>| 9 10 11 12 |</CODE></td></tr></table></td>
 </tr><tr><td></td><td></td></tr><tr>
 <td valign="middle"><CODE><font color="blue">STEP(M,1.5)</font></CODE></td>
 <td bgcolor="#FFFFCC"><table cellspacing="0"><tr><td><CODE>| 1 2 3 4 |</CODE></td></tr>
            <tr><td><CODE>| 1 2 3 4 |</CODE></td></tr>
            <tr><td><CODE>| 3 4 5 6 |</CODE></td></tr></table></td>
 </tr></table></P>
<p>
 <a href="roll.htm"><img align=middle border="0" src="../../shadow_left.gif">&nbsp;
 <font size="+1" color="olive">ROLL</font></a><br />
 <a href="wrap.htm"><img align=middle border="0" src="../../shadow_right.gif">&nbsp;
 <font size="+1" color="olive">WRAP</font></a>
</P>
</BODY>
</HTML>