SlideShare a Scribd company logo
1 of 18
Download to read offline
Introduction to Octave
Programming
Milad Nourizade
Urmia University of Technology
history
• At first it was intended to be a companion to a
chemical reactor design course software.
• Real development was started by Prof. John
W.Eaton in 1992.
• Octave version 5.1.0 has been released in
Mar 1,2019
Octave, the language
• GNU Octave is a high-level primarily intended for
numerical computations. It is typically used for such
problems as solving linear and nonlinear equations,
numerical linear algebra, statistical analysis. It is
particularly designed for matrix computations.
• The Octave language is an interpreted programming
language. It is free software under the terms of GNU
General Public License (GPL) written in C, C++, Fortran.
• Octave’s mostly syntax compatible with MATLAB which
is commonly used in industry and academia.
Who uses octave?
• NASA use it to develop spacecraft docking
systems.
• Jaguar Racing use it to display and analyse data
transmitted from their Formula 1 cars.
• Sheffield University use it to develop software to
recognize cancerous cells.
Variables
• We can assign a variable much like any other
language.
• In Octave we don’t declare the variable type,
Octave will do this on creation.
• A=5 name = “ Milad”
Arithmetic
• Addition +
• Subtraction -
• Multiplication *
• Division /
• Element-wise .+ .- .* ./ .^
Vectors and Matrices
• Vectors are n*1 or 1*n matrices:
• Row Vectors r= [1 2 3 4 5] or [1, 2, 3, 4, 5]
• Column Vectors c = [1;2;3;4;5]
• m = [1 2; 3 4]
• 2 by 2 matrix
1 2
3 4
Special Matrices
• Ones(n, m) — generates a matrix n x m of 1’s
• Zeros(n, m) — generates a matrix n x m of 0’s
• Eye(n) — generates n x n identity matrix
• Rand(n , m) — generates n x m matrix of
uniformly random elements.
• Magic(n) — generates n x n matrix that sum of
elements in row, column and diagonal is equal.
Colon Operator
• The colon operator is a great syntax for creating
a set of values.
• R = 1:5 returns a vector [1 2 3 4 5] with 1’s
steps.
• Or we can change steps with a specific step:
• S = 1:0.1:10 [1 , 1.1, 1.2, 1.3, … , 10]
Indexing
• Now we know about vectors and matrices how we can access
elements?
• *** Be careful Octave is not zero index it is one.
• S = [1 2; 3 4]
• S(1, 1) will return 1
S(1, [1,2]) will return [1, 2]
S(1, 1:2) will return [1, 2]
S(1, :) will return [1, 2]
• Colon operator here is like selecting all
Boolean Operators
• As you know this part is almost is same in todays programming
languages.
• == - Is Equal to
• != or ~= - Not Equal to
• > - Greater than
• < - Less than
• >= - Greater or equal to
• <= - Less than or equal to
• E.g 5 >= 4 ans = 1 5 <= 4 ans = 0
The if else Statement
• if (condition)
then-body
elseif (condition)
elseif-body
else
else-body
endif;
• Parenthesis is optional and you can use both
end and endif
For & While loop
• for i = 1:10
body;
endfor;
• while (condition)
body;
endwhile;
• As same you can summarize endfor and end
while with end.
Functions
• Functions with return value:
function ret = myFuncName(arguments)
do something with arguments and
set ret.
endfunction
• Functions with none-return value:
myFuncName(arguments)
do something with arguments
endfunction
.m files
• .m files are octave scripts to be run.
• Each function in Octave must be in its .m file of
the same name.
• Eg. minimum(x) needs to go in a file called
minimum.m
The edit command
• Octave CLI support some basic commands:
• ls
• cd
• pwd
• …
• Using Octave CLI you can use edit command to
open or create .m file in specific directory.
• Eg. edit mini.m
Multiple return values
• Octave supports returning more than one variable from a
function.
• All we have to do is putting return values in a matrix.
• The syntax:
function [ret1, ret2, … , ret n] = myFuncName(arguments)
do something with arguments and
set return values.
endfunction
Load & Save file
• Loading file in Octave is very easy to do.
Accepting many different data format.
• load <filename> or load(“ filename”) Which
loads file in a vector or matrix.
• Ether you can save data easy as loading.
• save < filename > variable

More Related Content

What's hot

Tech talk with Antmicro - Building your world out of blocks with renode and l...
Tech talk with Antmicro - Building your world out of blocks with renode and l...Tech talk with Antmicro - Building your world out of blocks with renode and l...
Tech talk with Antmicro - Building your world out of blocks with renode and l...RISC-V International
 
Application of greedy method
Application  of  greedy methodApplication  of  greedy method
Application of greedy methodTech_MX
 
OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++ANANT VYAS
 
PYTHON-Chapter 4-Plotting and Data Science PyLab - MAULIK BORSANIYA
PYTHON-Chapter 4-Plotting and Data Science  PyLab - MAULIK BORSANIYAPYTHON-Chapter 4-Plotting and Data Science  PyLab - MAULIK BORSANIYA
PYTHON-Chapter 4-Plotting and Data Science PyLab - MAULIK BORSANIYAMaulik Borsaniya
 
Python | What is Python | History of Python | Python Tutorial
Python | What is Python | History of Python | Python TutorialPython | What is Python | History of Python | Python Tutorial
Python | What is Python | History of Python | Python TutorialQA TrainingHub
 
Basic of Python- Hands on Session
Basic of Python- Hands on SessionBasic of Python- Hands on Session
Basic of Python- Hands on SessionDharmesh Tank
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonMohammed Rafi
 
How To Install Python Pip On Windows | Edureka
How To Install Python Pip On Windows | EdurekaHow To Install Python Pip On Windows | Edureka
How To Install Python Pip On Windows | EdurekaEdureka!
 
用 Kotlin 做自動化工具
用 Kotlin 做自動化工具用 Kotlin 做自動化工具
用 Kotlin 做自動化工具Shengyou Fan
 
A Sneak Peek of MLIR in TensorFlow
A Sneak Peek of MLIR in TensorFlowA Sneak Peek of MLIR in TensorFlow
A Sneak Peek of MLIR in TensorFlowKoan-Sin Tan
 
File Handling Python
File Handling PythonFile Handling Python
File Handling PythonAkhil Kaushik
 
Programming for Everybody in Python
Programming for Everybody in PythonProgramming for Everybody in Python
Programming for Everybody in PythonCharles Severance
 
Five Real-World Strategies for Perforce Streams
Five Real-World Strategies for Perforce StreamsFive Real-World Strategies for Perforce Streams
Five Real-World Strategies for Perforce StreamsPerforce
 
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...Edureka!
 

What's hot (20)

Tech talk with Antmicro - Building your world out of blocks with renode and l...
Tech talk with Antmicro - Building your world out of blocks with renode and l...Tech talk with Antmicro - Building your world out of blocks with renode and l...
Tech talk with Antmicro - Building your world out of blocks with renode and l...
 
Application of greedy method
Application  of  greedy methodApplication  of  greedy method
Application of greedy method
 
Presentation on python
Presentation on pythonPresentation on python
Presentation on python
 
OPERATORS OF C++
OPERATORS OF C++OPERATORS OF C++
OPERATORS OF C++
 
PYTHON-Chapter 4-Plotting and Data Science PyLab - MAULIK BORSANIYA
PYTHON-Chapter 4-Plotting and Data Science  PyLab - MAULIK BORSANIYAPYTHON-Chapter 4-Plotting and Data Science  PyLab - MAULIK BORSANIYA
PYTHON-Chapter 4-Plotting and Data Science PyLab - MAULIK BORSANIYA
 
Python - the basics
Python - the basicsPython - the basics
Python - the basics
 
Introduction to numpy
Introduction to numpyIntroduction to numpy
Introduction to numpy
 
Amritkumar RESUME(KPIT)
Amritkumar RESUME(KPIT)Amritkumar RESUME(KPIT)
Amritkumar RESUME(KPIT)
 
Python | What is Python | History of Python | Python Tutorial
Python | What is Python | History of Python | Python TutorialPython | What is Python | History of Python | Python Tutorial
Python | What is Python | History of Python | Python Tutorial
 
Basic of Python- Hands on Session
Basic of Python- Hands on SessionBasic of Python- Hands on Session
Basic of Python- Hands on Session
 
Python GUI
Python GUIPython GUI
Python GUI
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
How To Install Python Pip On Windows | Edureka
How To Install Python Pip On Windows | EdurekaHow To Install Python Pip On Windows | Edureka
How To Install Python Pip On Windows | Edureka
 
用 Kotlin 做自動化工具
用 Kotlin 做自動化工具用 Kotlin 做自動化工具
用 Kotlin 做自動化工具
 
Python
PythonPython
Python
 
A Sneak Peek of MLIR in TensorFlow
A Sneak Peek of MLIR in TensorFlowA Sneak Peek of MLIR in TensorFlow
A Sneak Peek of MLIR in TensorFlow
 
File Handling Python
File Handling PythonFile Handling Python
File Handling Python
 
Programming for Everybody in Python
Programming for Everybody in PythonProgramming for Everybody in Python
Programming for Everybody in Python
 
Five Real-World Strategies for Perforce Streams
Five Real-World Strategies for Perforce StreamsFive Real-World Strategies for Perforce Streams
Five Real-World Strategies for Perforce Streams
 
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
Tkinter Python Tutorial | Python GUI Programming Using Tkinter Tutorial | Pyt...
 

Similar to Gnu octave

Lecture 01 variables scripts and operations
Lecture 01   variables scripts and operationsLecture 01   variables scripts and operations
Lecture 01 variables scripts and operationsSmee Kaem Chann
 
Algorithms & Complexity Calculation
Algorithms & Complexity CalculationAlgorithms & Complexity Calculation
Algorithms & Complexity CalculationAkhil Kaushik
 
Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.supriyasarkar38
 
DSJ_Unit I & II.pdf
DSJ_Unit I & II.pdfDSJ_Unit I & II.pdf
DSJ_Unit I & II.pdfArumugam90
 
Developer’s viewpoint on swift programming language
Developer’s viewpoint on swift programming languageDeveloper’s viewpoint on swift programming language
Developer’s viewpoint on swift programming languageAzilen Technologies Pvt. Ltd.
 
Java 101 intro to programming with java
Java 101  intro to programming with javaJava 101  intro to programming with java
Java 101 intro to programming with javaHawkman Academy
 
Java 101 Intro to Java Programming
Java 101 Intro to Java ProgrammingJava 101 Intro to Java Programming
Java 101 Intro to Java Programmingagorolabs
 
02 functions, variables, basic input and output of c++
02   functions, variables, basic input and output of c++02   functions, variables, basic input and output of c++
02 functions, variables, basic input and output of c++Manzoor ALam
 
Unit I - 1R introduction to R program.pptx
Unit I - 1R introduction to R program.pptxUnit I - 1R introduction to R program.pptx
Unit I - 1R introduction to R program.pptxSreeLaya9
 
Introduction to java 101
Introduction to java 101Introduction to java 101
Introduction to java 101kankemwa Ishaku
 
Android webinar class_java_review
Android webinar class_java_reviewAndroid webinar class_java_review
Android webinar class_java_reviewEdureka!
 
Introduction to OpenSees by Frank McKenna
Introduction to OpenSees by Frank McKennaIntroduction to OpenSees by Frank McKenna
Introduction to OpenSees by Frank McKennaopenseesdays
 

Similar to Gnu octave (20)

Clojure intro
Clojure introClojure intro
Clojure intro
 
Lecture 01 variables scripts and operations
Lecture 01   variables scripts and operationsLecture 01   variables scripts and operations
Lecture 01 variables scripts and operations
 
Logic Programming and ILP
Logic Programming and ILPLogic Programming and ILP
Logic Programming and ILP
 
Unit 1.pptx
Unit 1.pptxUnit 1.pptx
Unit 1.pptx
 
Algorithms & Complexity Calculation
Algorithms & Complexity CalculationAlgorithms & Complexity Calculation
Algorithms & Complexity Calculation
 
Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.
 
DSJ_Unit I & II.pdf
DSJ_Unit I & II.pdfDSJ_Unit I & II.pdf
DSJ_Unit I & II.pdf
 
Developer’s viewpoint on swift programming language
Developer’s viewpoint on swift programming languageDeveloper’s viewpoint on swift programming language
Developer’s viewpoint on swift programming language
 
Matlab lec1
Matlab lec1Matlab lec1
Matlab lec1
 
DSA
DSADSA
DSA
 
Should i Go there
Should i Go thereShould i Go there
Should i Go there
 
Java 101 intro to programming with java
Java 101  intro to programming with javaJava 101  intro to programming with java
Java 101 intro to programming with java
 
Java 101 Intro to Java Programming
Java 101 Intro to Java ProgrammingJava 101 Intro to Java Programming
Java 101 Intro to Java Programming
 
02 functions, variables, basic input and output of c++
02   functions, variables, basic input and output of c++02   functions, variables, basic input and output of c++
02 functions, variables, basic input and output of c++
 
Python
PythonPython
Python
 
DAA Notes.pdf
DAA Notes.pdfDAA Notes.pdf
DAA Notes.pdf
 
Unit I - 1R introduction to R program.pptx
Unit I - 1R introduction to R program.pptxUnit I - 1R introduction to R program.pptx
Unit I - 1R introduction to R program.pptx
 
Introduction to java 101
Introduction to java 101Introduction to java 101
Introduction to java 101
 
Android webinar class_java_review
Android webinar class_java_reviewAndroid webinar class_java_review
Android webinar class_java_review
 
Introduction to OpenSees by Frank McKenna
Introduction to OpenSees by Frank McKennaIntroduction to OpenSees by Frank McKenna
Introduction to OpenSees by Frank McKenna
 

Recently uploaded

OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...ranjana rawat
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 

Recently uploaded (20)

OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 

Gnu octave

  • 1. Introduction to Octave Programming Milad Nourizade Urmia University of Technology
  • 2. history • At first it was intended to be a companion to a chemical reactor design course software. • Real development was started by Prof. John W.Eaton in 1992. • Octave version 5.1.0 has been released in Mar 1,2019
  • 3. Octave, the language • GNU Octave is a high-level primarily intended for numerical computations. It is typically used for such problems as solving linear and nonlinear equations, numerical linear algebra, statistical analysis. It is particularly designed for matrix computations. • The Octave language is an interpreted programming language. It is free software under the terms of GNU General Public License (GPL) written in C, C++, Fortran. • Octave’s mostly syntax compatible with MATLAB which is commonly used in industry and academia.
  • 4. Who uses octave? • NASA use it to develop spacecraft docking systems. • Jaguar Racing use it to display and analyse data transmitted from their Formula 1 cars. • Sheffield University use it to develop software to recognize cancerous cells.
  • 5. Variables • We can assign a variable much like any other language. • In Octave we don’t declare the variable type, Octave will do this on creation. • A=5 name = “ Milad”
  • 6. Arithmetic • Addition + • Subtraction - • Multiplication * • Division / • Element-wise .+ .- .* ./ .^
  • 7. Vectors and Matrices • Vectors are n*1 or 1*n matrices: • Row Vectors r= [1 2 3 4 5] or [1, 2, 3, 4, 5] • Column Vectors c = [1;2;3;4;5] • m = [1 2; 3 4] • 2 by 2 matrix 1 2 3 4
  • 8. Special Matrices • Ones(n, m) — generates a matrix n x m of 1’s • Zeros(n, m) — generates a matrix n x m of 0’s • Eye(n) — generates n x n identity matrix • Rand(n , m) — generates n x m matrix of uniformly random elements. • Magic(n) — generates n x n matrix that sum of elements in row, column and diagonal is equal.
  • 9. Colon Operator • The colon operator is a great syntax for creating a set of values. • R = 1:5 returns a vector [1 2 3 4 5] with 1’s steps. • Or we can change steps with a specific step: • S = 1:0.1:10 [1 , 1.1, 1.2, 1.3, … , 10]
  • 10. Indexing • Now we know about vectors and matrices how we can access elements? • *** Be careful Octave is not zero index it is one. • S = [1 2; 3 4] • S(1, 1) will return 1 S(1, [1,2]) will return [1, 2] S(1, 1:2) will return [1, 2] S(1, :) will return [1, 2] • Colon operator here is like selecting all
  • 11. Boolean Operators • As you know this part is almost is same in todays programming languages. • == - Is Equal to • != or ~= - Not Equal to • > - Greater than • < - Less than • >= - Greater or equal to • <= - Less than or equal to • E.g 5 >= 4 ans = 1 5 <= 4 ans = 0
  • 12. The if else Statement • if (condition) then-body elseif (condition) elseif-body else else-body endif; • Parenthesis is optional and you can use both end and endif
  • 13. For & While loop • for i = 1:10 body; endfor; • while (condition) body; endwhile; • As same you can summarize endfor and end while with end.
  • 14. Functions • Functions with return value: function ret = myFuncName(arguments) do something with arguments and set ret. endfunction • Functions with none-return value: myFuncName(arguments) do something with arguments endfunction
  • 15. .m files • .m files are octave scripts to be run. • Each function in Octave must be in its .m file of the same name. • Eg. minimum(x) needs to go in a file called minimum.m
  • 16. The edit command • Octave CLI support some basic commands: • ls • cd • pwd • … • Using Octave CLI you can use edit command to open or create .m file in specific directory. • Eg. edit mini.m
  • 17. Multiple return values • Octave supports returning more than one variable from a function. • All we have to do is putting return values in a matrix. • The syntax: function [ret1, ret2, … , ret n] = myFuncName(arguments) do something with arguments and set return values. endfunction
  • 18. Load & Save file • Loading file in Octave is very easy to do. Accepting many different data format. • load <filename> or load(“ filename”) Which loads file in a vector or matrix. • Ether you can save data easy as loading. • save < filename > variable