(By Amarjeet and Manpreet)

Amarjeet: It started with the question what’s the common between all the engineering streams? Answer: Maths

So ,math is the common domain and GNU octave is the software with maths as domain. So, It can be used by all engineers.

GNU Octaveis software featuring a high level programming language( fourth generation) Multi-paradigm

Helps in solving linear and non-linear problems, numerically and performs other numerical experiments. Also does image processing.

Octave is basically an open source software based on MATLAB.

Question : What is generation of language ?

Question: What is multi- paradigm?

Install Octave in terminal and write octave on the command line and start solving questions.

Basic data type of octave is matrix.

Matrices can be concatenated.

Q. What is difference between Sage and Octave?


Makes random matrix of a 3x3


Array Indexing

Array Indexing starts from 1 not from 0

2-d and 3-d Plots

Image processing

Matrix of an image is shown.

MATLAB is an abbreviation for “matrix laboratory”. While other programming languages mostly work with numbers one at a time, MATLAB is designed to operate primarily on whole matrices and arrays.

To create an array with four elements in a single row, separate the elements with either a comma (,) or a space.

a = [1 2 3 4]

a =

 1     2     3     4

This type of array is a row vector.

To create a matrix that has multiple rows, separate the rows with semicolons.

a = [1 2 3; 4 5 6; 7 8 10]

z = zeros(5,1)



Concatenation is the process of joining arrays to make larger ones. In fact, you made your first array by concatenating its individual elements. The pair of square brackets [] is the concatenation operator.

Complex Numbers

Complex numbers have both real and imaginary parts, where the imaginary unit is the square root of -1.


ans =

0.0000 + 1.0000i

To represent the imaginary part of complex numbers, use either i or j .

c = [3+4i, 4+3j; -i, 10j]

c =

3.0000 + 4.0000i 4.0000 + 3.0000i

0.0000 - 1.0000i 0.0000 +10.0000i

A = magic(4)

A =

16     2     3    13
 5    11    10     8
 9     7     6    12
 4    14    15     1


ans =


Less common, but sometimes useful, is to use a single subscript that traverses down each column in order:


To refer to multiple elements of an array, use the colon operator, which allows you to specify a range of the form start:end. For example, list the elements in the first three rows and the second column of A:


The colon operator also allows you to create an equally spaced vector of values using the more general form start:step:end.

B = 0:10:100

B = rand(3,5,2);

Workspace variables do not persist after you exit MATLAB. Save your data for later use with the save command,

save myfile.mat

Saving preserves the workspace in your current working folder in a compressed file with a .mat extension, called a MAT-file.

To clear all the variables from the workspace, use the clear command.

Restore data from a MAT-file into the workspace using load.

load myfile.mat



disp(‘hello world’)