Octave/MATLAB

Donations

£1.00


DellWindowsReinstallationGuide is written and maintained by Philip Yip. Scotland  , Great Britain (GB),  , United Kingdom (UK)  .

Donations

£1.00

Thanks in advance for leaving any donations Philip.


Octave/MATLAB is a computing language designed for scientists and engineers but has quite powerful plotting capabilities which may be useful to many other people. This is not an official course but rather a collection of notes made to myself whilst learning Octave/MATLAB in depth. This is my first time looking at programming in depth however I usually write quite detailed notes which may be useful for other people. MATLAB is expensive commerical software and Octave is an open source equivalent. I’ve focused on Octave so anyone who likes can download Octave and get started. Octave and MATLAB use the same programming language however and for the basics Octave and MATLAB are cross-compatible thus all the notes I write below will work in both products:

For more advanced things you’ll need to use MATLAB as it has a lot more support and functionality. This guide is designed for beginners however. I recommend those looking to learn how to use MATLAB/Octave to also sign up to the Mathworks website and take advantage of the free OnRamp and Deep Learning OnRamp courses, which give hands-on online training:

https://matlabacademy.mathworks.com/

The videos below I made whilst learning so are far less polished than the written guides above. Both are still a work in progress.

1. Octave vs MATLAB

I used Octave opposed to MATLAB in the following tutorial videos, in order for it to be accessible for anyone who wants to try. The syntax used is cross-compatible with MATLAB – everything I demonstrate in Octave can be done in MATLAB using the same code.

 

2. Installing Octave

Here I look at installing Octave.

Download Link: https://www.gnu.org/software/octave/download.html

3. Using Octave as a Scientific Calculator

Here I look at using Octave as a basic scientific calculator.

4. Assignment of Variables

Here I explain what a variable is and demonstrate assignment and use of variables.

5. Inputting Scalars and Matrices into Octave

Here I look at syntax for inputting Scalars, Vectors, Matrices and 3D Arrays in Octave. When the concept of Scalars, Vectors and Matrices are taught in mathematic classes, a lot of people are often left wondering what is the point? At the end I explain that an image is in actual fact a matrix, in addition to everything you see on your phone or computer screen is a matrix.

6a. Overview of Brackets in Octave: Looking at Inbuilt Functions

Here I look at some of the basic inbuilt functions. Functions are a crucial component of Octave (or MATLAB). When using them you need to understand their syntax therefore I spend some time to look at the use of curly brackets for designating inputs ( ) and square brackets [ ] for designating outputs.

6b. Overview of Brackets in Octave: Looking at Inbuilt Functions Example

This is a worked example to look at the use of some basic input functions. Once you’ve worked through it you should understand the syntax behind the brackets ( ) and [ ].

7. Matrix Operations: Addition, Subtraction, Multiplication and Division

I discuss element by element matrix operations such as element by element addition, element by element subtraction, element by element multiplication (the dot product), element by element division. Then I go on to discuss matrix multiplication and matrix division. I try to give examples of objects opposed to just a matrix of numbers (like often seen in mathematics classes) to help beginners conceptualise the concepts.

 

8. How we See and View Numbers vs How a Computer Stores Numbers: Decimal vs Binary

This one is slightly philosophical and looks at the way we understand numbers by looking at the Imperial measurement system, the way we look at time and questions why we have 10 number characters 0,1,2,3,4,5,6,7,8,9 and not more or less. It also looks at the way a computer stores a number, because the computer only has two number characters 0 and 1. This is called the binary system.

9. Data Types

A look at datatypes in Octave/MATLAB: numbers, single point float, double float, unsigned integers, integers, characters and strings.

10. Basic 2D Plotting

An overview of basic 2D plots using Octave or MATLAB. This looks at creating a line plot, a scatter plot and subplots. For the line plot I go through changing the colours, the line thickness, the line style. For the scatter plot I go through applying markers, changing the marker size and changing the marker face and marker edge colours. I also look at changing the axis limits, font size of the graphs and applying grid lines. I look at giving a title, x and y axis label and a legend. I also demonstrate subplots.

11. fprintf – Displaying Text in the Command Window

Using fprintf with Octave/MATLAB to display text in the command window. To call up a new line use \n and new tab use \t. To display an integer use %i, decimal number %f, exponential %e and string %s. Use 0.1, 0.2, 0.3 to change the number of significant figures displayed.

12. Creating Basic Custom Functions

An introduction to creating user custom functions and a detail on inputs and outputs. A custom unit converter function is created:

13. Creating a Custom Plot Using a Custom Function

I look at the creation of a basic custom nested function for plotting.

14. Basic Statistics

A look at carrying out basic statistics using simple example matrices in Octave. I look at calculating the mean, variance and standard deviation. I then look at the mode, median, min and max. I look at the difference, product, cumulative sum and cumulative product. I then look at the covariance and correlation coefficient.

15. Nearest, Linear and Cubic Interpolation

I go through manually interpolating a data point using it’s nearest neighbour, two nearest neighbours i.e. linear interpolation, three nearest neighbours i.e. quadratic interpolation and four nearest neighbours i.e. cubic interpolation. Once the principles are established with a single data point, I go ahead and use the interpolation function to interpolate a number of data points.

16. Histogramming Randomly Generated Numbers

A quick look at generating random numbers using Octave and visualising them using a Histogram plot. I look at rand which randomly generates numbers between 0 and 1, randn, which randomly generates numbers according to a normal distribution and randi, which generates randomly generated numbers between 1 and a specified maximum.

 

17. Use of the inbuilt functions polyfit and polyval to fit a linear, quadratic and cubic equation to a model curve

Use of the inbuilt functions polyfit and polyval to fit a linear, quadratic and cubic equation to a model curve.