Geoscience Reference
In-Depth Information
organized in directories on the hard disk. h e default search path includes
only the MATLAB_R2014b directory that has been created by the installer
in the applications folder and the default working directory MATLAB . To
see which directories are in the search path or to add new directories, select
Set Path from the Home toolstrip of the MATLAB desktop, and use the Set
Path dialog box. h e modii ed search path is saved in a i le pathdef.m on your
hard disk. h e sot ware will then in future read the contents of this i le and
direct MATLAB to use your custom path list.
2.3 The Syntax
h e name MATLAB stands for matrix laboratory . h e classic object handled
by MATLAB is a matrix , i.e., a rectangular two-dimensional array of numbers.
A simple 1-by-1 array is a scalar . Arrays with one column or row are vectors ,
time series or other one-dimensional data i elds. An m -by- n array can be
used for a digital elevation model or a grayscale image. Red, green and blue
(RGB) color images are usually stored as three-dimensional arrays, i.e., the
colors red, green and blue are represented by an m -by- n -by-3 array.
Before proceeding, we need to clear the workspace by typing
clear
at er the prompt in the Command Window. Clearing the workspace is
always recommended before working on a new MATLAB project to avoid
name conl icts with previous projects. We can also go a step further, close
all Figure Windows using close all and clear the content of the Command
Window using clc . It is therefore recommended that a new MATLAB project
should always start with the line
clear, close all, clc
Entering matrices or arrays in MATLAB is easy. To enter an arbitrary matrix,
type
A = [2 4 3 7; 9 3 -1 2; 1 9 3 7; 6 6 3 -2]
which i rst dei nes a variable A , then lists the elements of the array in square
brackets. h e rows of A are separated by semicolons, whereas the elements
of a row are separated by blank spaces, or alternatively, by commas. At er
pressing return , MATLAB displays the array
A =
2 4 3 7
9 3 -1 2
Search WWH ::




Custom Search