esercizi sulle matrici: --> A=[1:+2:5;2:+2:6;1 2 3

]

A = 1 3 5 2 4 6 1 2 3

--> size(A)

ans = 3 3

--> size(8)

ans = 1 1

--> V=A(1:3)

V = 1 2 1

--> V= A(2,1:3)

V = 2 4 6

--> length(v) Error: Undefined function or variable v

1.1.1.1:3)) Error: Undefined function or variable a --> length(A(2.2:+2:6.1.2:+2:6.--> length(a(2.1:3)) ans = 3 --> trill(A) Error: Undefined function or variable trill --> tril(A) Error: Undefined function or variable tril --> tril(A) Error: Undefined function or variable tril --> triu(A) Error: Undefined function or variable triu --> tril(A) Error: Undefined function or variable tril --> tril(V) Error: Undefined function or variable tril --> A=[1:+2:5.1 2 3 1.1 2 3 1] A = 1 3 5 1 2 4 6 1 1 2 3 1 --> A=[1:+2:5.1 1 1 1] A = 1 3 5 1 .

2 4 6 1 1 2 3 1 1 1 1 1 --> A=[1:+2:5.1) .1.-2) Error: Undefined function or variable tril --> tril(A.1) Error: Undefined function or variable triu --> diag(A) ans = 1 4 3 1 --> diag(A.ones(1.2:+2:6. Error: Undefined function or variable tril --> triu(A.-1) Error: Undefined function or variable tril --> tril(A.4)] A = 1 3 5 1 2 4 6 1 1 2 3 1 1 1 1 1 --> tril(A.1.-3).1 2 3 1.

4) ans = 0 0 0 0 2 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .ans = 3 6 1 --> diag(V) ans = 2 0 0 0 4 0 0 0 6 --> triu(diag(V)) Error: Undefined function or variable triu --> diag(V.1) ans = 0 2 0 0 0 0 4 0 0 0 0 6 0 0 0 0 --> diag(V.

-2) ans = 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 4 0 0 0 0 0 6 0 0 --> ones(4.5) ans = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 --> eye(7) ans = .0 0 0 0 0 0 0 0 0 0 0 0 0 0 --> diag(V.4) ans = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 --> ones(3.

1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 --> sum(V) ans = 12 --> v' Error: Undefined function or variable v --> sum(v') Error: Undefined function or variable v --> sum(A) ans = 5 10 15 4 --> sum(A.2) ans = 10 13 7 4 .

--> sum(A.1) ans = 5 10 15 4 --> sum(sum(A)) ans = 34 --> prod(V) ans = 48 --> prod(A) ans = 2 24 90 1 --> prod(A.2) ans = 15 48 6 1 --> det(A) .

2500 -0.0000 0.ans = 0 --> A(4.5000 2.7500 0.0000 0.3)=5 A = 1 3 5 1 2 4 6 1 1 2 3 1 1 1 5 1 --> det(A) ans = 4 --> B=inv(A) B = -1.0000 0 0 -1.5000 0 -0.5000 0.2500 0 --> B*A ans = 1 0 0 0 0 1 0 0 0 0 1 0 .2500 0 1.5000 0.

0 0 0 1 --> det(inv(A)) ans = 0.1.1.1.4.4.1.4.5] V = 2 4 6 1 1 1 4 5 --> norm(V.1.5) Error: Unexpected input V=(V.2500 --> det(A)*det(B) ans = 1.1.1.5) ^ --> V=[V.1.0000 --> V ans = 2 4 6 --> V=(V.1.inf) ans = .

^2 ans = 4 16 36 1 1 1 16 25 --> sqrt(sum(abs(V).1) ans = 24 --> Y=abs(V) Y = 2 4 6 1 1 1 4 5 --> sum(Y) ans = 24 --> norm(V) ans = 10 --> abs(V).^2)) ans = .6 --> norm(V.

1) ans = 19 --> norm(A'.1) ans = 13 --> norm(A) ans = 11.6619 --> norm(eye(A)) .5172 --> norm(A.inf) ans = 13 --> norm(A.10 --> norm(A.'fro') ans = 11.f) Error: Undefined function or variable f --> norm(A.

.m(eye) at line 15 In docli(builtin) at line 1 In base(base) In base() In global() Error: Dimension arguments must be either all scalars or a single vector --> norm(eye(sqrt(5))) ans = 1 --> max(V) ans = 6 --> min(V) ans = 1 --> help max MAX MAX Maximum Function Usage Computes the maximum of an array along a given dimension.In /usr/share/freemat/toolbox/matrix/eye. computes two arrays (entry-wise) and keeps the smaller value for each array. or alternate ly.

the maximum is based on the magnitude of the numbers.As a result.z) where x and z are either both numerical arrays of the same dimensions. the output is the same size as both arrays. the output is defined elementwise by the . The second general syntax for the use of the max function is [y. In the first case. in which case t he output y is the maximum of x along dimension d. the index of the first maximum is used. In the event that multiple maxima are present with the same value. the max function has a number of syntaxes.n] = max(x) In this case.n] = max(x. The first one computes the maximum of an array along a given dimension. NaNs are ignored in the calculations. the general syntax i s y = max(x. The third general syntax for the use of the max function is as a comparison function for pairs of arrays. and is defined elementwise by the smaller of the two arrays. or one of the two is a scalar. The first general syntax for its use is either [y. In the second case. The second argument n is the index that results in the maximum. Here. For complex data types.[]. the maximum is taken along the first non-singleton dimension of x.d) where x is a multidimensional array of numerical type.

--> .