Graphics Programs Reference
In-Depth Information
ans =
NaN
>> 5*NaN
% Most operations with NaN result in NaN
ans =
NaN
>> NaN == NaN
% Different NaN's are not equal!
ans =
0
>> eps
ans =
2.2204e-016
Arrays
Arrayscan becreatedinseveral ways. One of themistotype the elements of the array
betweenbrackets. The elements in each rowmust beseparatedbyblanks or commas.
Here is an example of generatinga3
×
3matrix:
>>A=[2-1 0
-1 2 -1
0-1 1]
A=
2
-1
0
-1
2
-1
0
-1
1
The elements can also betyped onasingle line, separating the rows with semi-
colons:
>>A=[2-10;-12-1;0-11]
A=
2
-1
0
-1
2
-1
0
-1
1
Unlike most computer languages, MATLAB differentiates betweenrow and col-
umn vectors (this peculiarityis a frequentsource of programming and inputerrors).
For example,
Search WWH ::
Custom Search