Programmer Guide/Command Reference/EVAL/init: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 2: Line 2:
Create a vector or a matrix and initialize it with a particular value.
Create a vector or a matrix and initialize it with a particular value.
;Usage: <code>init(<var>rows</var> {, <var>cols</var> {, <var>value</var>}})</code>
;Usage: <code>init(<var>rows</var> {, <var>cols</var> {, <var>value</var>}})</code>
::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>]]


=====Parameters:=====
=====Parameters:=====

Revision as of 13:10, 4 April 2011

Create a vector or a matrix and initialize it with a particular value.

Usage
init(rows {, cols {, value}})
note: if n is a vector, ncol(n) is used as number of elements
x0
start value, must be a scalar (default=0)
dx
increment, must be a scalar (default=0)
Result
The result is a vector r with n elements. The elements are initialized with: ri = x0 + i*dx; i=0..n-1
See also
init, rand

<function list>


Parameters:
rows
The number of rows. There is no default.
cols
The number of columns. The default is 1.
value
The value to initialize with. The default is 0.
Return Type:

vector or matrix

See also
fill, rand,

Navigation menu

Personal tools