1> a = [1 0; 0 0] a = 1 0 0 0 2> b = [0 0; 1 0] b = 0 0 1 0 3> a * b ans = 0 0 0 0 4> zeros(2,2) ans = 0 0 0 0 5> zeros(2) ans = 0 0 0 0 6> zeros(1,2) ans = 0 0 7> zeros(2,1) ans = 0 0 8> eye(3) ans = Diagonal Matrix 1 0 0 0 1 0 0 0 1 9> A = [1 2 3; 4 5 6] A = 1 2 3 4 5 6 10> A(1,1) ans = 1 11> A(2,3) ans = 6 12> A(3,3) error: A(I): Index exceeds matrix dimension. 12> size(A) ans = 2 3 13> size(size(A)) ans = 1 2 14> prima_riga = A(1,:) prima_riga = 1 2 3 15> seconda_riga = A(2,:) seconda_riga = 4 5 6 16> seconda_colonna = A(:,2) seconda_colonna = 2 5 17> A A = 1 2 3 4 5 6 18> B = rand(5,7) B = 0.18159 0.61397 0.47166 0.83820 0.91103 0.48082 0.70010 0.72497 0.10070 0.44979 0.74015 0.41501 0.39108 0.70145 0.24339 0.54686 0.24706 0.33227 0.46547 0.71661 0.99870 0.76578 0.16223 0.57641 0.75573 0.78772 0.86061 0.93794 0.71160 0.98585 0.14373 0.74692 0.91765 0.87322 0.41101 19> help fix `fix' is a built-in function -- Mapping Function: fix (X) Truncate fractional portion of X and return the integer portion. This is equivalent to rounding towards zero. If X is complex, return `fix (real (X)) + fix (imag (X)) * I'. fix ([-2.7, 2.7]) => -2 2 See also: ceil, floor, round Additional help for built-in functions and operators is available in the on-line version of the manual. Use the command `doc ' to search the manual index. Help and information about Octave is also available on the WWW at http://www.octave.org and via the help@octave.org mailing list. 20> C = fix(6 * B + 1) C = 2 4 3 6 6 3 5 5 1 3 5 3 3 5 2 4 2 2 3 5 6 5 1 4 5 5 6 6 5 6 1 5 6 6 3 21> randn(1,1) ans = -0.48930 22> randn(1,1) ans = -0.85198 23> randn(1,1) ans = 0.52010 24> casuale = randn(1,10000); 25> min(casuale) ans = -3.6322 26> max(casuale) ans = 3.4620 27> mean(casuale) ans = -0.0021253 28> C C = 2 4 3 6 6 3 5 5 1 3 5 3 3 5 2 4 2 2 3 5 6 5 1 4 5 5 6 6 5 6 1 5 6 6 3 29> size(C) ans = 5 7 30> D = C([2, 4], [3, 5, 7]) D = 3 3 5 4 5 6 31> ones(3,4) ans = 1 1 1 1 1 1 1 1 1 1 1 1 32> C C = 2 4 3 6 6 3 5 5 1 3 5 3 3 5 2 4 2 2 3 5 6 5 1 4 5 5 6 6 5 6 1 5 6 6 3 33> triu(C) ans = 2 4 3 6 6 3 5 0 1 3 5 3 3 5 0 0 2 2 3 5 6 0 0 0 5 5 6 6 0 0 0 0 6 6 3 34> tril(C) ans = 2 0 0 0 0 0 0 5 1 0 0 0 0 0 2 4 2 0 0 0 0 5 1 4 5 0 0 0 5 6 1 5 6 0 0 35> diag(C) ans = 2 1 2 5 6 36> diagonale = diag(C) diagonale = 2 1 2 5 6 37> diag(diagonale) ans = Diagonal Matrix 2 0 0 0 0 0 1 0 0 0 0 0 2 0 0 0 0 0 5 0 0 0 0 0 6 38> a a = 1 0 0 0 39> A A = 1 2 3 4 5 6 40> trasposta = A.' trasposta = 1 4 2 5 3 6 41> trasposta = A' trasposta = 1 4 2 5 3 6 42> AA = [3 -i, 4+7i] AA = 3 + 0i -0 - 1i 4 + 7i 43> AA = [3-i, 4+7i] AA = 3 - 1i 4 + 7i 44> AA.' ans = 3 - 1i 4 + 7i 45> AA' ans = 3 + 1i 4 - 7i 46> quit