inf sts cw 10 03 12

background image

>> a=2+3i

a =

2.0000 + 3.0000i

>> b=5+4i;

>> who

Your variables are:

a ans b

>> 2+2

ans =

4

>> c=1000000

c =

1000000

>> c=1000000000

background image

c =

1.0000e+009

>> d=1/c

d =

1.0000e-009

>> e

??? Undefined function or variable 'e'.

>> e=0.5

e =

1/2

>> format short

>> e

e =

0.5000

>> a

background image

a =

2.0000 + 3.0000i

>> a=2-5i

a =

2.0000 - 5.0000i

>> a

a =

2.0000 - 5.0000i

>> w=[1 2 3 4 5 6 7 8 9 ]

w =

1 2 3 4 5 6 7 8 9

>> v=[9;8;7;6;5;4;3;2;1]

v =

background image

9

8

7

6

5

4

3

2

1

>> w*v

ans =

165

>> v*w

ans =

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

background image

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> A=ans

A =

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> w.*v'

ans =

9 16 21 24 25 24 21 16 9

>> w'.*v

ans =

background image

9

16

21

24

25

24

21

16

9

>> w(1)=3

w =

3 2 3 4 5 6 7 8 9

>> w(2:4)=[1 1 1]

w =

3 1 1 1 5 6 7 8 9

>> lenght(w)

??? Undefined function or method 'lenght' for input arguments of type 'double'.

>> length(9)

background image

ans =

1

>> length(w)

ans =

9

>> w(9)=[]

w =

3 1 1 1 5 6 7 8

>> w(9)=[0]

w =

3 1 1 1 5 6 7 8 0

>> w(4:6)=[]

w =

3 1 1 7 8 0

background image

>> w=[w[1 1 1]]

??? w=[w[1 1 1]]

|

Error: Unbalanced or unexpected parenthesis or bracket.

>> w=[w[1 1 1]]

??? w=[w[1 1 1]]

|

Error: Unbalanced or unexpected parenthesis or bracket.

>> sum(2)

ans =

2

>> prod(w)

ans =

0

>> w(6)=-1

w =

background image

3 1 1 7 8 -1

>> prod(w)

ans =

-168

>> w

w =

3 1 1 7 8 -1

>> cumsum(w)

ans =

3 4 5 12 20 19

>> cunmprod(w)

??? Undefined function or method 'cunmprod' for input arguments of type 'double'.

>> cumprod(w)

ans =

background image

3 3 3 21 168 -168

>> mean(w)

ans =

3.1667

>> sum(w)/length(w)

ans =

3.1667

>> std(w)

ans =

3.6009

>> median(w)

ans =

2

>> sort(w)

background image

ans =

-1 1 1 3 7 8

>> min(w)

ans =

-1

>> max(w)

ans =

8

>> mod(w)

??? Error using ==> mod

Not enough input arguments.

>> moda(w)

??? Undefined function or method 'moda' for input arguments of type 'double'.

>> B=[w;w;w]

B =

background image

3 1 1 7 8 -1

3 1 1 7 8 -1

3 1 1 7 8 -1

>> w(1:2:9)

??? Index exceeds matrix dimensions.

>> w(1:2:5)

ans =

3 1 8

>> w(12:length(w))

ans =

Empty matrix: 1-by-0

>> w(2:2:length(w)=[]

??? w(2:2:length(w)=[]

|

Error: The expression to the left of the equals sign is not a valid target for an

assignment.

>> w

background image

w =

3 1 1 7 8 -1

>> w(6:9)=[1 2 3]

??? In an assignment A(I) = B, the number of elements in B and

I must be the same.

>> w(6)=4

w =

3 1 1 7 8 4

>> A

A =

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

background image

1 2 3 4 5 6 7 8 9

>> min A

ans =

65

>> min(A)

ans =

1 2 3 4 5 6 7 8 9

>> minmin(A)

??? Undefined function or method 'minmin' for input arguments of type 'double'.

>> min(min(A))

ans =

1

>> max(A)

ans =

background image

9 18 27 36 45 54 63 72 81

>> max(max(A))

ans =

81

>> mean(A)

ans =

5 10 15 20 25 30 35 40 45

>> mean(mean(A))

ans =

25

>> sum(A)

ans =

45 90 135 180 225 270 315 360 405

>> a

background image

a =

2.0000 - 5.0000i

>> A

A =

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> sum(sum(A))

ans =

2025

>> A(2,1)=2

background image

A =

9 18 27 36 45 54 63 72 81

2 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> a

a =

2.0000 - 5.0000i

>> det(A)

ans =

0

>> A(1,:)[]

??? A(1,:)[]

|

background image

Error: Unbalanced or unexpected parenthesis or bracket.

>> A(:,1)=[]

A =

18 27 36 45 54 63 72 81

16 24 32 40 48 56 64 72

14 21 28 35 42 49 56 63

12 18 24 30 36 42 48 54

10 15 20 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> det(A)

??? Error using ==> det

Matrix must be square.

>> A(1,:)=[1 1 1 1 1 1 1 1]

A =

1 1 1 1 1 1 1 1

16 24 32 40 48 56 64 72

14 21 28 35 42 49 56 63

background image

12 18 24 30 36 42 48 54

10 15 20 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> A(1:2,:)=[]

A =

14 21 28 35 42 49 56 63

12 18 24 30 36 42 48 54

10 15 20 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> det(A)

??? Error using ==> det

Matrix must be square.

>> A(1:3,1:3)=eye(3)

A =

background image

1 0 0 35 42 49 56 63

0 1 0 30 36 42 48 54

0 0 1 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> diag(A)

ans =

1

1

1

20

18

14

8

>> >> a=2+3i

a =

2.0000 + 3.0000i

>> b=5+4i;

background image

>> who

Your variables are:

a ans b

>> 2+2

ans =

4

>> c=1000000

c =

1000000

>> c=1000000000

c =

1.0000e+009

>> d=1/c

d =

background image

1.0000e-009

>> e

??? Undefined function or variable 'e'.

>> e=0.5

e =

1/2

>> format short

>> e

e =

0.5000

>> a

a =

2.0000 + 3.0000i

>> a=2-5i

background image

a =

2.0000 - 5.0000i

>> a

a =

2.0000 - 5.0000i

>> w=[1 2 3 4 5 6 7 8 9 ]

w =

1 2 3 4 5 6 7 8 9

>> v=[9;8;7;6;5;4;3;2;1]

v =

9

8

7

6

5

4

3

background image

2

1

>> w*v

ans =

165

>> v*w

ans =

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> A=ans

A =

background image

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> w.*v'

ans =

9 16 21 24 25 24 21 16 9

>> w'.*v

ans =

9

16

21

24

25

24

21

background image

16

9

>> w(1)=3

w =

3 2 3 4 5 6 7 8 9

>> w(2:4)=[1 1 1]

w =

3 1 1 1 5 6 7 8 9

>> lenght(w)

??? Undefined function or method 'lenght' for input arguments of type 'double'.

>> length(9)

ans =

1

>> length(w)

ans =

background image

9

>> w(9)=[]

w =

3 1 1 1 5 6 7 8

>> w(9)=[0]

w =

3 1 1 1 5 6 7 8 0

>> w(4:6)=[]

w =

3 1 1 7 8 0

>> w=[w[1 1 1]]

??? w=[w[1 1 1]]

|

Error: Unbalanced or unexpected parenthesis or bracket.

>> w=[w[1 1 1]]

background image

??? w=[w[1 1 1]]

|

Error: Unbalanced or unexpected parenthesis or bracket.

>> sum(2)

ans =

2

>> prod(w)

ans =

0

>> w(6)=-1

w =

3 1 1 7 8 -1

>> prod(w)

ans =

-168

background image

>> w

w =

3 1 1 7 8 -1

>> cumsum(w)

ans =

3 4 5 12 20 19

>> cunmprod(w)

??? Undefined function or method 'cunmprod' for input arguments of type 'double'.

>> cumprod(w)

ans =

3 3 3 21 168 -168

>> mean(w)

ans =

3.1667

background image

>> sum(w)/length(w)

ans =

3.1667

>> std(w)

ans =

3.6009

>> median(w)

ans =

2

>> sort(w)

ans =

-1 1 1 3 7 8

>> min(w)

background image

ans =

-1

>> max(w)

ans =

8

>> mod(w)

??? Error using ==> mod

Not enough input arguments.

>> moda(w)

??? Undefined function or method 'moda' for input arguments of type 'double'.

>> B=[w;w;w]

B =

3 1 1 7 8 -1

3 1 1 7 8 -1

3 1 1 7 8 -1

>> w(1:2:9)

??? Index exceeds matrix dimensions.

background image

>> w(1:2:5)

ans =

3 1 8

>> w(12:length(w))

ans =

Empty matrix: 1-by-0

>> w(2:2:length(w)=[]

??? w(2:2:length(w)=[]

|

Error: The expression to the left of the equals sign is not a valid target for an

assignment.

>> w

w =

3 1 1 7 8 -1

>> w(6:9)=[1 2 3]

??? In an assignment A(I) = B, the number of elements in B and

background image

I must be the same.

>> w(6)=4

w =

3 1 1 7 8 4

>> A

A =

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> min A

ans =

65

background image

>> min(A)

ans =

1 2 3 4 5 6 7 8 9

>> minmin(A)

??? Undefined function or method 'minmin' for input arguments of type 'double'.

>> min(min(A))

ans =

1

>> max(A)

ans =

9 18 27 36 45 54 63 72 81

>> max(max(A))

ans =

81

background image

>> mean(A)

ans =

5 10 15 20 25 30 35 40 45

>> mean(mean(A))

ans =

25

>> sum(A)

ans =

45 90 135 180 225 270 315 360 405

>> a

a =

2.0000 - 5.0000i

>> A

background image

A =

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> sum(sum(A))

ans =

2025

>> A(2,1)=2

A =

9 18 27 36 45 54 63 72 81

2 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

background image

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> a

a =

2.0000 - 5.0000i

>> det(A)

ans =

0

>> A(1,:)[]

??? A(1,:)[]

|

Error: Unbalanced or unexpected parenthesis or bracket.

>> A(:,1)=[]

A =

18 27 36 45 54 63 72 81

background image

16 24 32 40 48 56 64 72

14 21 28 35 42 49 56 63

12 18 24 30 36 42 48 54

10 15 20 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> det(A)

??? Error using ==> det

Matrix must be square.

>> A(1,:)=[1 1 1 1 1 1 1 1]

A =

1 1 1 1 1 1 1 1

16 24 32 40 48 56 64 72

14 21 28 35 42 49 56 63

12 18 24 30 36 42 48 54

10 15 20 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

background image

>> A(1:2,:)=[]

A =

14 21 28 35 42 49 56 63

12 18 24 30 36 42 48 54

10 15 20 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> det(A)

??? Error using ==> det

Matrix must be square.

>> A(1:3,1:3)=eye(3)

A =

1 0 0 35 42 49 56 63

0 1 0 30 36 42 48 54

0 0 1 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

background image

>> diag(A)

ans =

1

1

1

20

18

14

8

>>

??? >> a=2+3i

|

Error: Unexpected MATLAB operator.

>> A

A =

1 0 0 35 42 49 56 63

0 1 0 30 36 42 48 54

0 0 1 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

background image

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> diag(A,1)

ans =

0

0

25

24

21

16

9

>> B=A(2:5,3:6)

B =

0 30 36 42

1 25 30 35

16 20 24 28

12 15 18 21

>> celar(A)

??? Undefined function or method 'celar' for input arguments of type 'double'.

background image

>> celar A

??? Undefined function or method 'celar' for input arguments of type 'char'.

>> clear A

>> A=magic(5)

A =

17 24 1 8 15

23 5 7 14 16

4 6 13 20 22

10 12 19 21 3

11 18 25 2 9

>> SUM(a)

??? Undefined function or method 'SUM' for input arguments of type 'double'.

>> sum(A)

ans =

65 65 65 65 65

>> det(A)

ans =

background image

5.0700e+006

>>A^0.5

Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

>> a=2+3i

a =

2.0000 + 3.0000i

>> b=5+4i;

>> who

Your variables are:

a ans b

>> 2+2

ans =

4

>> c=1000000

c =

background image

1000000

>> c=1000000000

c =

1.0000e+009

>> d=1/c

d =

1.0000e-009

>> e

??? Undefined function or variable 'e'.

>> e=0.5

e =

1/2

>> format short

>> e

background image

e =

0.5000

>> a

a =

2.0000 + 3.0000i

>> a=2-5i

a =

2.0000 - 5.0000i

>> a

a =

2.0000 - 5.0000i

>> w=[1 2 3 4 5 6 7 8 9 ]

w =

1 2 3 4 5 6 7 8 9

background image

>> v=[9;8;7;6;5;4;3;2;1]

v =

9

8

7

6

5

4

3

2

1

>> w*v

ans =

165

>> v*w

ans =

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

background image

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> A=ans

A =

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> w.*v'

ans =

9 16 21 24 25 24 21 16 9

background image

>> w'.*v

ans =

9

16

21

24

25

24

21

16

9

>> w(1)=3

w =

3 2 3 4 5 6 7 8 9

>> w(2:4)=[1 1 1]

w =

3 1 1 1 5 6 7 8 9

background image

>> lenght(w)

??? Undefined function or method 'lenght' for input arguments of type 'double'.

>> length(9)

ans =

1

>> length(w)

ans =

9

>> w(9)=[]

w =

3 1 1 1 5 6 7 8

>> w(9)=[0]

w =

3 1 1 1 5 6 7 8 0

background image

>> w(4:6)=[]

w =

3 1 1 7 8 0

>> w=[w[1 1 1]]

??? w=[w[1 1 1]]

|

Error: Unbalanced or unexpected parenthesis or bracket.

>> w=[w[1 1 1]]

??? w=[w[1 1 1]]

|

Error: Unbalanced or unexpected parenthesis or bracket.

>> sum(2)

ans =

2

>> prod(w)

ans =

0

background image

>> w(6)=-1

w =

3 1 1 7 8 -1

>> prod(w)

ans =

-168

>> w

w =

3 1 1 7 8 -1

>> cumsum(w)

ans =

3 4 5 12 20 19

>> cunmprod(w)

??? Undefined function or method 'cunmprod' for input arguments of type 'double'.

background image

>> cumprod(w)

ans =

3 3 3 21 168 -168

>> mean(w)

ans =

3.1667

>> sum(w)/length(w)

ans =

3.1667

>> std(w)

ans =

3.6009

>> median(w)

background image

ans =

2

>> sort(w)

ans =

-1 1 1 3 7 8

>> min(w)

ans =

-1

>> max(w)

ans =

8

>> mod(w)

??? Error using ==> mod

Not enough input arguments.

>> moda(w)

background image

??? Undefined function or method 'moda' for input arguments of type 'double'.

>> B=[w;w;w]

B =

3 1 1 7 8 -1

3 1 1 7 8 -1

3 1 1 7 8 -1

>> w(1:2:9)

??? Index exceeds matrix dimensions.

>> w(1:2:5)

ans =

3 1 8

>> w(12:length(w))

ans =

Empty matrix: 1-by-0

>> w(2:2:length(w)=[]

??? w(2:2:length(w)=[]

background image

|

Error: The expression to the left of the equals sign is not a valid target for an

assignment.

>> w

w =

3 1 1 7 8 -1

>> w(6:9)=[1 2 3]

??? In an assignment A(I) = B, the number of elements in B and

I must be the same.

>> w(6)=4

w =

3 1 1 7 8 4

>> A

A =

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

background image

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> min A

ans =

65

>> min(A)

ans =

1 2 3 4 5 6 7 8 9

>> minmin(A)

??? Undefined function or method 'minmin' for input arguments of type 'double'.

>> min(min(A))

ans =

1

background image

>> max(A)

ans =

9 18 27 36 45 54 63 72 81

>> max(max(A))

ans =

81

>> mean(A)

ans =

5 10 15 20 25 30 35 40 45

>> mean(mean(A))

ans =

25

>> sum(A)

background image

ans =

45 90 135 180 225 270 315 360 405

>> a

a =

2.0000 - 5.0000i

>> A

A =

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> sum(sum(A))

ans =

background image

2025

>> A(2,1)=2

A =

9 18 27 36 45 54 63 72 81

2 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> a

a =

2.0000 - 5.0000i

>> det(A)

ans =

background image

0

>> A(1,:)[]

??? A(1,:)[]

|

Error: Unbalanced or unexpected parenthesis or bracket.

>> A(:,1)=[]

A =

18 27 36 45 54 63 72 81

16 24 32 40 48 56 64 72

14 21 28 35 42 49 56 63

12 18 24 30 36 42 48 54

10 15 20 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> det(A)

??? Error using ==> det

Matrix must be square.

>> A(1,:)=[1 1 1 1 1 1 1 1]

background image

A =

1 1 1 1 1 1 1 1

16 24 32 40 48 56 64 72

14 21 28 35 42 49 56 63

12 18 24 30 36 42 48 54

10 15 20 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> A(1:2,:)=[]

A =

14 21 28 35 42 49 56 63

12 18 24 30 36 42 48 54

10 15 20 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> det(A)

??? Error using ==> det

Matrix must be square.

background image

>> A(1:3,1:3)=eye(3)

A =

1 0 0 35 42 49 56 63

0 1 0 30 36 42 48 54

0 0 1 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> diag(A)

ans =

1

1

1

20

18

14

8

>> >> a=2+3i

background image

a =

2.0000 + 3.0000i

>> b=5+4i;

>> who

Your variables are:

a ans b

>> 2+2

ans =

4

>> c=1000000

c =

1000000

>> c=1000000000

c =

background image

1.0000e+009

>> d=1/c

d =

1.0000e-009

>> e

??? Undefined function or variable 'e'.

>> e=0.5

e =

1/2

>> format short

>> e

e =

0.5000

>> a

a =

background image

2.0000 + 3.0000i

>> a=2-5i

a =

2.0000 - 5.0000i

>> a

a =

2.0000 - 5.0000i

>> w=[1 2 3 4 5 6 7 8 9 ]

w =

1 2 3 4 5 6 7 8 9

>> v=[9;8;7;6;5;4;3;2;1]

v =

9

8

background image

7

6

5

4

3

2

1

>> w*v

ans =

165

>> v*w

ans =

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

background image

>> A=ans

A =

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> w.*v'

ans =

9 16 21 24 25 24 21 16 9

>> w'.*v

ans =

9

16

background image

21

24

25

24

21

16

9

>> w(1)=3

w =

3 2 3 4 5 6 7 8 9

>> w(2:4)=[1 1 1]

w =

3 1 1 1 5 6 7 8 9

>> lenght(w)

??? Undefined function or method 'lenght' for input arguments of type 'double'.

>> length(9)

ans =

background image

1

>> length(w)

ans =

9

>> w(9)=[]

w =

3 1 1 1 5 6 7 8

>> w(9)=[0]

w =

3 1 1 1 5 6 7 8 0

>> w(4:6)=[]

w =

3 1 1 7 8 0

>> w=[w[1 1 1]]

background image

??? w=[w[1 1 1]]

|

Error: Unbalanced or unexpected parenthesis or bracket.

>> w=[w[1 1 1]]

??? w=[w[1 1 1]]

|

Error: Unbalanced or unexpected parenthesis or bracket.

>> sum(2)

ans =

2

>> prod(w)

ans =

0

>> w(6)=-1

w =

3 1 1 7 8 -1

background image

>> prod(w)

ans =

-168

>> w

w =

3 1 1 7 8 -1

>> cumsum(w)

ans =

3 4 5 12 20 19

>> cunmprod(w)

??? Undefined function or method 'cunmprod' for input arguments of type 'double'.

>> cumprod(w)

ans =

3 3 3 21 168 -168

background image

>> mean(w)

ans =

3.1667

>> sum(w)/length(w)

ans =

3.1667

>> std(w)

ans =

3.6009

>> median(w)

ans =

2

>> sort(w)

ans =

background image

-1 1 1 3 7 8

>> min(w)

ans =

-1

>> max(w)

ans =

8

>> mod(w)

??? Error using ==> mod

Not enough input arguments.

>> moda(w)

??? Undefined function or method 'moda' for input arguments of type 'double'.

>> B=[w;w;w]

B =

3 1 1 7 8 -1

background image

3 1 1 7 8 -1

3 1 1 7 8 -1

>> w(1:2:9)

??? Index exceeds matrix dimensions.

>> w(1:2:5)

ans =

3 1 8

>> w(12:length(w))

ans =

Empty matrix: 1-by-0

>> w(2:2:length(w)=[]

??? w(2:2:length(w)=[]

|

Error: The expression to the left of the equals sign is not a valid target for an

assignment.

>> w

w =

background image

3 1 1 7 8 -1

>> w(6:9)=[1 2 3]

??? In an assignment A(I) = B, the number of elements in B and

I must be the same.

>> w(6)=4

w =

3 1 1 7 8 4

>> A

A =

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

background image

>> min A

ans =

65

>> min(A)

ans =

1 2 3 4 5 6 7 8 9

>> minmin(A)

??? Undefined function or method 'minmin' for input arguments of type 'double'.

>> min(min(A))

ans =

1

>> max(A)

ans =

9 18 27 36 45 54 63 72 81

background image

>> max(max(A))

ans =

81

>> mean(A)

ans =

5 10 15 20 25 30 35 40 45

>> mean(mean(A))

ans =

25

>> sum(A)

ans =

45 90 135 180 225 270 315 360 405

>> a

a =

background image

2.0000 - 5.0000i

>> A

A =

9 18 27 36 45 54 63 72 81

8 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> sum(sum(A))

ans =

2025

>> A(2,1)=2

A =

background image

9 18 27 36 45 54 63 72 81

2 16 24 32 40 48 56 64 72

7 14 21 28 35 42 49 56 63

6 12 18 24 30 36 42 48 54

5 10 15 20 25 30 35 40 45

4 8 12 16 20 24 28 32 36

3 6 9 12 15 18 21 24 27

2 4 6 8 10 12 14 16 18

1 2 3 4 5 6 7 8 9

>> a

a =

2.0000 - 5.0000i

>> det(A)

ans =

0

>> A(1,:)[]

??? A(1,:)[]

|

Error: Unbalanced or unexpected parenthesis or bracket.

background image

>> A(:,1)=[]

A =

18 27 36 45 54 63 72 81

16 24 32 40 48 56 64 72

14 21 28 35 42 49 56 63

12 18 24 30 36 42 48 54

10 15 20 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> det(A)

??? Error using ==> det

Matrix must be square.

>> A(1,:)=[1 1 1 1 1 1 1 1]

A =

1 1 1 1 1 1 1 1

16 24 32 40 48 56 64 72

14 21 28 35 42 49 56 63

12 18 24 30 36 42 48 54

10 15 20 25 30 35 40 45

background image

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> A(1:2,:)=[]

A =

14 21 28 35 42 49 56 63

12 18 24 30 36 42 48 54

10 15 20 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> det(A)

??? Error using ==> det

Matrix must be square.

>> A(1:3,1:3)=eye(3)

A =

1 0 0 35 42 49 56 63

0 1 0 30 36 42 48 54

background image

0 0 1 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> diag(A)

ans =

1

1

1

20

18

14

8

>>

??? >> a=2+3i

|

Error: Unexpected MATLAB operator.

>> A

A =

background image

1 0 0 35 42 49 56 63

0 1 0 30 36 42 48 54

0 0 1 25 30 35 40 45

8 12 16 20 24 28 32 36

6 9 12 15 18 21 24 27

4 6 8 10 12 14 16 18

2 3 4 5 6 7 8 9

>> diag(A,1)

ans =

0

0

25

24

21

16

9

>> B=A(2:5,3:6)

B =

0 30 36 42

1 25 30 35

16 20 24 28

background image

12 15 18 21

>> celar(A)

??? Undefined function or method 'celar' for input arguments of type 'double'.

>> celar A

??? Undefined function or method 'celar' for input arguments of type 'char'.

>> clear A

>> A=magic(5)

A =

17 24 1 8 15

23 5 7 14 16

4 6 13 20 22

10 12 19 21 3

11 18 25 2 9

>> SUM(a)

??? Undefined function or method 'SUM' for input arguments of type 'double'.

>> sum(A)

ans =

65 65 65 65 65

background image

>> det(A)

ans =

5.0700e+006

>>


Wyszukiwarka

Podobne podstrony:
inf sts cw 14 4 12
Podstawy turystyki 10.03.12, II semestr, Podstawy turystyki
Podstawy turystyki 10.03.12, II semestr, Podstawy turystyki
cw 10 03, Studia, bazy danych, LABORATORIUM I-SZY STOP
Podstawy turystyki 10.03.12, II semestr, Podstawy turystyki
Podstawy turystyki 10.03.12, II semestr, Podstawy turystyki
Pomiar duzych prądów przemiennych o czestotliwości 50Hz [ćw] 1997 03 12
Pomiar duzych prądów przemiennych o czestotliwości 50Hz [ćw] 1997 03 12
Makroekonomia wykład 01 z dn 10 03 12
Cw 10 12 v8XM
Antropologia kultury- opracowanie na ćw[1][1]. 03.12, SOCJOLOgia, Antropologia
inf.trans., wykłady 10.10.12, Infrastruktura - podstawowe urządzenia, budynki użyteczności publiczne
PODSTAWY ZARZĄDZANIA ćw 20.03.10 20, Materiały studia, Podstawy zarządzania ćwiczenia
Nauka o Organizacji cw 6 10 12
fi cw 10 12
10 Ekonomia (12.03.2011r.), Ekonomia WSHGIT Piotruś
Prawo cywilne ćw.10 2012-03-05, Prawo Cywilne
Gl leśne stac program ćw 2013-od 12-03, STUDIA SGGW Wydział Leśny leśnictwo, Semestr 1 i 2, Glebozn
inf trans , wykłady1 10 12

więcej podobnych podstron