Geoscience Reference
In-Depth Information
A =
Columns 1 through 2
0.8147 + 0.0000i 0.9134 + 0.0000i
0.9058 + 0.0000i 0.6324 + 0.0000i
0.1270 + 0.0000i 0.0975 + 0.0000i
Columns 3 through 4
3.0000 + 4.0000i 0.9649 + 0.0000i
0.5469 + 0.0000i 0.1576 + 0.0000i
0.9575 + 0.0000i 0.9706 + 0.0000i
and the variable listing is now
Name Size Bytes Class Attributes
A 3x4 192 double complex
B 3x4 48 single
indicating the class double and the attribute complex .
MATLAB also works with even smaller data types such as 1-bit, 8-bit
and 16-bit data, in order to save memory. h ese data types are used to store
digital elevation models or images (see Chapters 7 and 8). For example
m -by- n pixel RGB true color images are usually stored as three-dimensional
arrays, i.e., the three colors are represented by an m -by- n -by-3 array (see
Chapter 8 for more details on RGB composites and true color images). Such
multi-dimensional arrays can be generated by concatenating three two-
dimensional arrays representing the m -by- n pixels of an image. First, we
generate a 100-by-100 array of uniformly distributed random numbers in
the range [0,1]. We then multiply the random numbers by 255 to get values
between 0 and 255.
clear
rng(0)
I1 = 255 * rand(100,100);
I2 = 255 * rand(100,100);
I3 = 255 * rand(100,100);
h e command cat concatenates the three two-dimensional arrays (8 bits
each) into a three-dimensional array (3ยท8 bits=24 bits).
I = cat(3,I1,I2,I3);
Since RGB images are represented by integer values between 0 and 255 for
each color, we convert the 64-bit double-precision values to unsigned 8-bit
integers using uint8 (Section 8.2). h e function uint8 rounds the values in
I to the nearest integer. Any values that are outside the range [0,255] are
assigned to the nearest endpoint (0 or 255).
Search WWH ::




Custom Search