%% Vectors and Matrices in MATLAB % %% Defining vectors and matrices % % A row vector is created with the command b = [1 2 3 4] %% % Other possibilities include b = 1:4 %% % or b = linspace(1,5,4) %% % A column vector is obtained by typing c = [2; 4; 6] %% % or c = [2 4 6]' %% % A matrix can be defined by typing A = [1 2 3 2 3 4 5 6 7 8 9 0] %% % or A = [1 2 3; 2 3 4; 5 6 7; 8 9 0] %% Some special matrices B = zeros(4,2) %% E = eye(3) %% C = ones(3,2) %% % Now we can define a block matrix D = [A B; C E]