You are on page 1of 74

Warning: MATLAB Toolbox Path Cache is out of date and is not being used.

Type 'help toolbox_path_cache' for more info


>> -5/(4.8+5.32)^2

ans =

-0.0488

>> (3+4i)*(3-4i)

ans =

25

>> cos(pi/2)

ans =

6.1232e-017

>> exp(acos(0.3))

ans =

3.5470

>>
>> a=2

a=

>> b = 5;
>> a^b

ans =

32

>> x = 5/2*pi;
>> y = sin (x)

y=

>> z = asin(y)

z=

1.5708

>>
>> 1 2
??? 1 2
|
Error: Unexpected MATLAB expression.

>> a=[1 2;3 4]

a=

>> b=[-2.8, sqrt(-7), (3+5+6)*3/4]

b=

-2.8000

0 + 2.6458i 10.5000

>> b(2,5) = 23

b=

-2.8000
0

0 + 2.6458i 10.5000
0

0
0

23.0000

>> b=zeros(100,100)

b=

Columns 1 through 17

Columns 18 through 34

Columns 35 through 51

Columns 52 through 68

Columns 69 through 85

Columns 86 through 100

>> b(50,50) = 2.5

b=

Columns 1 through 10

Columns 11 through 20

Columns 21 through 30

Columns 31 through 40

Columns 41 through 50

2.5000

Columns 51 through 60

Columns 61 through 70

Columns 71 through 80

Columns 81 through 90

Columns 91 through 100

>> w=[1 2;3 4] + 5

w=

>> x = 1:5

x=

>> y = 2:-0.5:0

y=

2.0000

1.5000

1.0000

0.5000

>> z = rand(2,4)

z=

0.8147

0.1270

0.6324

0.2785

0.9058

0.9134

0.0975

0.5469

>> x=linspace(1,10,100)

x=

Columns 1 through 10

1.0000 1.0909
1.7273 1.8182

1.1818

1.2727

1.3636

1.4545

1.5455

1.6364

Columns 11 through 20

1.9091 2.0000
2.6364 2.7273

2.0909

2.1818

2.2727

2.3636

2.4545

2.5455

3.0909

3.1818

3.2727

3.3636

3.4545

4.0000

4.0909

4.1818

4.2727

4.3636

4.9091

5.0000

5.0909

5.1818

5.2727

5.8182

5.9091

6.0000

6.0909

6.1818

Columns 21 through 30

2.8182 2.9091
3.5455 3.6364

3.0000

Columns 31 through 40

3.7273 3.8182
4.4545 4.5455

3.9091

Columns 41 through 50

4.6364 4.7273
5.3636 5.4545

4.8182

Columns 51 through 60

5.5455 5.6364
6.2727 6.3636

5.7273

Columns 61 through 70

6.4545 6.5455
7.1818 7.2727

6.6364

6.7273

6.8182

6.9091

7.0000

7.0909

7.6364

7.7273

7.8182

7.9091

8.0000

8.5455

8.6364

8.7273

8.8182

8.9091

9.4545

9.5455

9.6364

9.7273

9.8182

1.3000

1.4000

1.5000

1.6000

1.7000

Columns 71 through 80

7.3636 7.4545
8.0909 8.1818

7.5455

Columns 81 through 90

8.2727 8.3636
9.0000 9.0909

8.4545

Columns 91 through 100

9.1818 9.2727
9.9091 10.0000

9.3636

>> x=1:0.1:10

x=

Columns 1 through 10

1.0000 1.1000
1.8000 1.9000

1.2000

Columns 11 through 20

2.0000 2.1000
2.8000 2.9000

2.2000

2.3000

2.4000

2.5000

2.6000

2.7000

3.3000

3.4000

3.5000

3.6000

3.7000

4.3000

4.4000

4.5000

4.6000

4.7000

5.3000

5.4000

5.5000

5.6000

5.7000

6.3000

6.4000

6.5000

6.6000

6.7000

7.3000

7.4000

7.5000

7.6000

7.7000

Columns 21 through 30

3.0000 3.1000
3.8000 3.9000

3.2000

Columns 31 through 40

4.0000 4.1000
4.8000 4.9000

4.2000

Columns 41 through 50

5.0000 5.1000
5.8000 5.9000

5.2000

Columns 51 through 60

6.0000 6.1000
6.8000 6.9000

6.2000

Columns 61 through 70

7.0000 7.1000
7.8000 7.9000

7.2000

Columns 71 through 80

8.0000 8.1000
8.8000 8.9000

8.2000

8.3000

8.4000

8.5000

8.6000

8.7000

9.3000

9.4000

9.5000

9.6000

9.7000

Columns 81 through 90

9.0000 9.1000
9.8000 9.9000

9.2000

Column 91

10.0000

>> x=1:n+1
??? Undefined function or variable 'n'.

>> cat_a=[a, 2*a; 3*a, 4*a; 5*a, 6*a]

cat_a =

12

12

10

15

20

18

16
12
24

>> A=[1 5 9;4 3 2.5; 0.1 10 3i+1]

A=

1.0000

5.0000

9.0000

4.0000

3.0000

2.5000

0.1000

10.0000

1.0000 + 3.0000i

>> A(:,2)=[]

A=

1.0000

9.0000

4.0000

2.5000

0.1000

1.0000 + 3.0000i

>> A(2,2)=[]
??? Subscripted assignment dimension mismatch.

>> A(:,2)

ans =

9.0000
2.5000

1.0000 + 3.0000i

>> A(:,2)=0

A=

1.0000

4.0000

0.1000

>> A(:,2) = []

A=

1.0000
4.0000
0.1000

>>

You might also like