Programmer Guide/Command Reference/EVAL/fill: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
m (1 revision: Initial import) |
No edit summary |
||
Line 29: | Line 29: | ||
If <var>n</var> is a vector, the length of the vector is used. | If <var>n</var> is a vector, the length of the vector is used. | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | |||
Create a vector with equally spaced elements. | |||
;Usage: '''<code>fill(<var>n</var>{, <var>x0</var>{, <var>dx</var>}})</code>''' | |||
:;<var>n</var>: vector length, a scalar (>0) | |||
::note: if ''n'' is a vector, ncol(''n'') is used as number of elements | |||
:;<var>x0</var>start value, must be a scalar (default='''0''') | |||
:;<var>dx</var>increment, must be a scalar (default='''0''') | |||
;Result: The result is a vector r with ''n'' elements. The elements are initialized with: <code>''r''<sub>i</sub> = ''x0'' + i * ''dx''; i=0..''n''-1''</code> | |||
;See also: [[Programmer_Guide/Command_Reference/EVAL/init|init]], [[Programmer_Guide/Command_Reference/EVAL/rand|rand]] | |||
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]] |
Revision as of 13:06, 4 April 2011
Contents
fill
Create a vector with a linear function.
Usage:
fill(n, d, k)
Parameters:
- n
- The number of elements. There is no default.
- d
- The start value. The default is
0
.
- k
- The increment step value. The default is
0
.
Result:
The result is: x[i = 0..n-1] = d + i*k
Notes:
If n is a vector, the length of the vector is used.
Create a vector with equally spaced elements.
- Usage
fill(n{, x0{, dx}})
- n
- vector length, a scalar (>0)
- note: if n is a vector, ncol(n) is used as number of elements
- x0start value, must be a scalar (default=0)
- dxincrement, must be a scalar (default=0)