% special matrices
% zeros(m,n): gives an m x n matrix of 0's
MTX1 = zeros(2,3)
% only 1 argument is needed for a square matrix
MTX2 = zeros(3)
% same as
MTX2 = zeros(3,3)

% ones(m,n): gives an n x m matrix of 1's
MTX3 = ones(4,5)

% the 6 x 6 identity matrix:
MTX4 = eye(6)

% take a vector as the diagonal element of 
% a square matrix
MTX5 = diag([ 9 3 6 2 7])

% extract the diaognal element of a square matrix
RD = rand(4,4)
Dg = diag(RD)

% scalar expansion:
2 - RD
RESULT = ans
RESUL10 = 10*RESULT
RESUL11 = 10 ./ RESULT

% elementwise exponentiation
Vec = 2 .^ (1:5)
Vec2 = (2:6) .^ (1:5)
Vec2 = (2:6) ^ 2
Vec22 = (2:6) .^ 2


MTX3
len = length(MTX3)
% is the same as
len2 = max(size(MTX3))

% the sum function
s = sum((1:20))

RD
% sum each column to produce a row vector
s2 = sum(RD)
% same as
s3 = sum(RD,1)

% sum each row to produce a column vector
s4 = sum(RD,2)

% logical matrices

% logical scalar variables
logic1 = true
logic2 = false

% in input/output: 1 for true and 0 for false
logic1

% local variables are usually the result of 
% relational operations:
logic3 = 4 > 8  % false
logic3 = 5 > 3  % true
logic4 = 3 == 7 % false

% logical matrices involving relations with matrices
RD1 = rand(3), 
RD2 = rand(3), 
LOGIC = RD1 > RD2
% element of LOGIC is 1 whenever the 
% corresponding element of RD1 is greater than
% that of RD2, otherwise it is 0.

