0% found this document useful (0 votes)
19 views10 pages

Hu

Uploaded by

hasibkk33
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views10 pages

Hu

Uploaded by

hasibkk33
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

>> a=3;

>> b=6;

>> a+b

ans =

>> a^2

ans =

>> a=[1;2;3]

a=

>> a=8;

>> b=3;

>> a*b

ans =

24
>> a=4;

>> b=7;

>> a+b

ans =

11

>> a-b

ans =

-3

>> a*b

ans =

28

>> a/b

ans =

0.5714

>> b^a
ans =

2401

>> c=[1;2;3]

c=

>> d=[1 2 3]

d=

1 2 3

>> a=[2:0.5:6];

>> size(a)

ans =

1 9

>> length(a)

ans =
9

>> u=[1 2 3];

>> v=[4 5 6];

>> add=u+v

add =

5 7 9

>> diff=u-v

diff =

-3 -3 -3

>> mull=u.*v

mull =

4 10 18

>> div=u./v

div =

0.2500 0.4000 0.5000

>> p=u.^v
p=

1 32 729

>> d=dot(u,v)

d=

32

>> v=[1 2 3;3 2 1;2 3 1];

>> i=inv(v)

i=

-0.0833 0.5833 -0.3333

-0.0833 -0.4167 0.6667

0.4167 0.0833 -0.3333

>> d=det(v)

d=

12

>> v=[10 9 8 7];

>> t=v'
t=

10

>> v=[3 3 3];

>> c=cumsum(v)

c=

3 6 9

>> v=[5 9 6]

v=

5 9 6

>> p=prod(v)

p=

270

>> v=[9 8 7 6]

v=
9 8 7 6

>> m=mean(v)

m=

7.5000

>> m=median(v)

m=

7.5000

s=sort(v,'descend')

s=

9 8 7 6

>> ones(3,3)

ans =

1 1 1

1 1 1

1 1 1

>> zeros(3,3)
ans =

0 0 0

0 0 0

0 0 0

>> rand(3,3)

ans =

0.8147 0.9134 0.2785

0.9058 0.6324 0.5469

0.1270 0.0975 0.9575Did you mean:

>> eye(4,40)

ans =

Columns 1 through 16

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0

Columns 17 through 32

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Columns 33 through 40

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

>> magic

c=

3 6 9

Not enough input arguments.

Error in magic (line 9)

n = floor(real(double(n(1))));

>> magic(7)

ans =

30 39 48 1 10 19 28

38 47 7 9 18 27 29

46 6 8 17 26 35 37

5 14 16 25 34 36 45

13 15 24 33 42 44 4

21 23 32 41 43 3 12
22 31 40 49 2 11 20

You might also like