0% found this document useful (0 votes)
24 views

To Get Started, Select "MATLAB Help" From The Help Menu

The document demonstrates various MATLAB operations including: - Defining and manipulating scalar and vector variables - Performing arithmetic operations on variables - Creating matrices and transposing/extracting elements - Generating vectors using built-in functions like linspace and logspace - Indexing/extracting elements from matrices and vectors
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

To Get Started, Select "MATLAB Help" From The Help Menu

The document demonstrates various MATLAB operations including: - Defining and manipulating scalar and vector variables - Performing arithmetic operations on variables - Creating matrices and transposing/extracting elements - Generating vectors using built-in functions like linspace and logspace - Indexing/extracting elements from matrices and vectors
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

To get started, select "MATLAB Help" from the Help menu.

>> V=3

V=

>> V+5

ans =

>> V=3+7

V=

10

>> V^4

ans =

10000

>> m1={1,4,9,2,25,1/4}

m1 =

Columns 1 through 4

[1

] [4

] [9

] [2

Columns 5 through 6

[25

] [1/4

>> m1=[1,4,9,2,25,1/4]

m1 =

Columns 1 through 4

Columns 5 through 6

25

1/4

>> m1=[1,4,9,2,25,1/4]

m1 =

1.0000 4.0000 9.0000 2.0000 25.0000 0.2500

>> sqrt(m1)

ans =

1393/985

1/2

>> sqrt(m1)

ans =

1.0000 2.0000 3.0000 1.4142 5.0000 0.5000

>> V2=[5:5:25]

V2 =

10

15

>> V3=[10:30]

V3 =

Columns 1 through 8

20

25

10

11

12

13

14

15

16

17

21

22

23

24

25

29

30

22

26

Columns 9 through 16

18

19

20

Columns 17 through 21

26

27

28

>> V4=linspace(10,30,6)

V4 =

10

14

18

30

>> V5=logspace(10,30,6)

V5 =

>> V5=logspace(10,30,6)

V5 =

1.0e+030 *

0.0000 0.0000 0.0000 0.0000 0.0001 1.0000

>> V5=logspace(10,30,6)

V5 =

1.0000e+010 1.0000e+014 1.0000e+018 1.0000e+022 1.0000e+026 1.0000e+030

>> V5=logspace(10,30,6)

V5 =

1.0e+030 *

Columns 1 through 5

0.00000000000000 0.00000000000000 0.00000000000100 0.00000001000000


0.00010000000000

Column 6

1.00000000000000

>> A=[10;20;30;40;]

A=

10
20
30
40

>> A=(10:14); b=A'

b=

10
11
12
13
14

>> C=(A')'

C=

10 11 12 13 14

>> X=(1:10)

X=

9 10

>> X(6)

ans =

>> X(6)

ans =

>> X(4:7)

ans =

>> X(2:3:9)

ans =

>> X(9:-3:2)

ans =

>> A=[1 3 5;7 9 11]

A=

9 11

>> A(2.3)=0
Warning: Subscript indices must be integer values.

A=

9 11

>> A(2,3)=0

A=

>> B=A'

B=

>> C=[B eye(3)]

C=

>> D=C(:, 1:2:5)

D=

>> E=C([1 2],[3 5])

E=

>> F=C([1 2], 3:5)

F=

>> G=diag(diag(D))

G=

>> H=C([1 3], [2 3 5])

H=

>> C=[B eye(3)]

C=

>> I=[eye(5,4) zeros(5,4) ones(5,4)]

I=

>> I(1. :)
??? I(1. :)
|
Error: Expected a variable, function, or constant, found ")".

>> I(1, :)

ans =

>> J=I(1:2:5, 2:2:12)

J=

>> size(J)

ans =

You might also like