Some basic expressions in Octave

Here’s the list of expressions used in Octave.
Octave official page


1.Checking the size of a matrix

A = [2 2; 3 3; 4 4;];

size(A)⇒(3,2)

size(A,1)⇒(3)

2.Generating a random matrix

A = randi([1 4],3,5)⇒

3 4 4 4 3

4 1 2 2 2

4 4 2 1 3

3.Transpose Matrix

I = ones(1,5)⇒

1 1 1 1 1

IcolV = I'⇒

1

1

1

1

1

A * IcolV⇒

18

11

14

4.Powering and Multiplication at each element

M = [1 3; 2 2; 2 3;];

M.^2⇒

1 9

4 4

4 9

N = [1 3; 2 2; 2 3;];

M .* N⇒

1 9

4 4

4 9

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *