what semicolon does it is says go to next row
A = [1 2; 3 4; 5 6] -> generates a 3 * 2 matrix 1 2 is the first and second column
V = [1 2 3] -> row vector
V = [1;2;3] -> column vector
V = 1;0.1;2 -> row vector with v incrementing by 0.1 till 2
v = 1:6 -> row vector with 1 -> 6 elements [1 2 3 4 5 6]
ones(2,3) generates a 2 by 3 matrix with all ones
C = 2*ones(2,3) it multiplies all 1's with 2 and it generates a matrix with all 2's
w = zeroes(1,3)
I = eye(4) 4 by 4 identity matrix (all diagonals 1)
size(A, 1) -> rows
size(A,2) -> columns
length(A) -> gives size of longest dimension
v = priceY(1:10)
Now v is first 10 elements of Y
A(3,2) will get element 3rd row 2nd columns
A(2,:) gets everything in 2nd row ->
A(:,2) gets everything in 2nd column
A([1,3],:) -> get everything from 1st and 3rd row and all columns
A(:,[1,3]) -> get all rows but just 1st and 3rd columns
A(:,2) = [10,11,12] -> replace 2nd column by 10, 11 and 12
A = [A, [100; 101; 102]]
A(:)
C = [A B]
v + ones(length(v),1) also we can do just v+1
for i=1:10,
v(i) = 2^i
end;
if v(1) == 1,
disp('value is one')
elseif v(1) == 2,
disp('value is 2')
else
disp('value is not one or 2')
end;