Geoscience Reference
In-Depth Information
yields the output
A =
Columns 1 through 2
0.814723686393179 0.913375856139019
0.905791937075619 0.632359246225410
0.126986816293506 0.097540404999410
Columns 3 through 4
0.278498218867048 0.964888535199277
0.546881519204984 0.157613081677548
0.957506835434298 0.970592781760616
which autowraps those lines that are longer than the width of the Command
Window. h e command format does not af ect how the computations are
carried out, i.e., the precision of the computation results remains unchanged.
h e precision is, however, af ected by converting the data type from double
to 32-bit single precision . Typing
B = single(A)
yields
B =
0.8147237 0.9133759 0.2784982 0.9648885
0.9057919 0.6323593 0.5468815 0.1576131
0.1269868 0.0975404 0.9575068 0.9705928
Although we have switched to format long , only 8 digits are displayed. h e
command whos lists the variables A and B with information on their sizes or
dimensions, number of bytes, and classes
Name Size Bytes Class Attributes
A 3x4 96 double
B 3x4 48 single
h e default class double is used in all MATLAB operations in which the
physical memory of the computer is not a limiting factor, whereas single
is used when working with large data sets. h e double-precision variable A ,
whose size is 3-by-4 elements, requires 3·4·64=768 bits or 768/8=96 bytes
of memory, whereas B requires only 48 bytes and so has half the memory
requirement of A . Introducing at least one complex number to A doubles
the memory requirement since both real and imaginary parts are double
precision, by default. Switching back to format short and typing
format short
A(1,3) = 4i + 3
yields
Search WWH ::




Custom Search