Programming Fundamentals - The MathWorks - #35

/ 840


catalogue search
P. 01
P. 02
P. 03
P. 04
P. 05
P. 06
P. 07
P. 08
P. 09
P. 10
P. 11
P. 12
P. 13
P. 14
P. 15
P. 16
P. 17
P. 18
P. 19
P. 20
P. 21
P. 22
P. 23
P. 24
P. 25
P. 26
P. 27
P. 28
P. 29
P. 30
P. 31
P. 32
P. 33
P. 34
P. 35
P. 36
P. 37
P. 38
P. 39
P. 40
P. 41
P. 42
P. 43
P. 44
P. 45
P. 46
P. 47
P. 48
P. 49
P. 50


See other catalogues for The MathWorks

Text version of the page
Creating and Concatenating Matrices
D = blkdiag(A, B, C) D =
8 1 6 0 0 0 0 0 35700000 49200000 0 0 0 -5 -6 -9 0 0 0 0 0-4-4-2 0 0
00000080 00000008
Generating a Numeric Sequence
Because numeric sequences can often be useful in constructing and indexing into matrices and arrays, MATLAB provides a special operator to assist in creating them.
This section covers
• "The Colon Operator" on page 1-11
• "Using the Colon Operator with a Step Value" on page 1-12
The Colon Operator
The colon operator (first:last) generates a 1-by-n matrix (or vector)of sequential numbers from the first valuetothe last. The default sequence is made up of incremental values, each 1 greater than the previous one:
A = 10:15
A=
10 11 12 13 14 15
The numeric sequence does not have to be made up of positive integers. It can include negative numbers and fractional numbers as well:
A = -2.5:2.5
A=
-2.5000 -1.5000 -0.5000 0.5000 1.5000 2.5000
By default, MATLAB always increments by exactly 1 when creating the sequence, even ifthe ending value is not an integral distance from the start:
1-11

pageCatalog pdf di En 2012-06-22-01