% I use + ... to return to the next line
auxString = "My name is Elizabeth, I am 20 " + ...
    "years old and " + ...
    "I live 2.5 km from Macerata";
disp(auxString)
name = "Anne";
age = 22;
distance = 5.5;
auxString = sprintf("My name is %s, I am %d years old " + ...
    "and I live %.2f km from Macerata", name, age, distance);
disp(auxString)

v1 = 1:10
v2 = linspace(2, 10, 5) % 2:2:10

% Concatenation of the two arrays
v3 = [v1 v2] % or v3 = [v1, v2]

% Select from v3 the elements in position 1, 2, 4, and 8
v4 = v3([1, 2, 4, 8])

% Reverse vector v4
v5 = v4(end:-1:1)

% A new vector from 1 to the end of v5
v6 = 1:length(v5)

% I create a matrix having v5 and v6 as columns
A = [v5' v6']

% I concatenate v5 and v6 as column vectors
v7 = [v5 v6]'

% or
v7 = [v5'; v6']

% I want to add the column [5 6 7 8] to the matrix A
A = [A, [5, 6, 7, 8]']

% I want to delete the first column
A(:, 1) = []
% Read this as: set all the rows of the first column
% equal to the empty array

% Restore the first column
A = [v5' A]

% Restore the original matrix A
A = [[8 1 5]; A; [1 4 8]]

% Delete the first and the last row from matrix A
A([1 end], :) = []

% Save in B the matrix obtained deleting the second
% column and the third row from matrix A
B = A([1 2 4], [1 3])
% This means that I am selecting rows 1, 2, and 4 and
% columns 1 and 3 at the same time

% or:
% first I copy matrix A so matrix A does not undergo changes
C = A;

% Then I delete the third row
C(3, :) = [];

% Then I delete the second column
C(:, 2) = []

% I add vector v5 to matrix A
A = [A, v5']

% I want to subtract 3 to every element of the matrix A
A = A - 3

% I want to multiply each element of the matrix by -2
A = -2*A % In this case it is not necessary to put the dot

% I want to put in matrix C all the elements of A squared
C = A.^2

% I want to put in matrix D the power of 2 of all the elements
% of matrix A
D = 2.^A

% E = A + C
E = A + C

% Identity matrix: it is a square matrix (i.e., the number
% of rows is equal to the number of columns with 1 along
% the main diagonal and 0 in the remaining positions
I = eye(4)