MATLAB stands for MATrix LABoratory. It was designed to make matrix manipulation easy for scientific computations.According to Mathworks website,MATLAB is the high level interactive programming environment used by Millions of scientists, engineers, analytics professionals worldwide. Learning Octave & MATLAB are the best available tools for prototyping the algorithms of machine learning.

This is what widely followed in Silicon valley as well. A lot of companies which work on artificial intelligence or machine learning algorithms first try to prototype the concept and when they make sure that the algorithm can behave as they wanted it to be, then they work on full blown scalable applications which can then be programmed in Java or C++ to achieve the efficiency.

### The advantage of using MATLAB/Octave

There are several advantages of using MATLAB & Octave for machine learning and general analytics. Some of these are mentioned below:

- These are the environments which provide scripting and programming support both. Just like Python or Bash, you can just try small snippets of code on the prompt and see the output.
- A large support for image processing and speech recognition. Support provided for integration with libraries such as OpenCV.
- MATLAB can generate automatically the equivalent C code which can be used to make better and efficient systems.
- Community support is the best feature of MATLAB environment. It is a popular programming environment and you can get almost any kind of solution to any problem on Internet related to MATLAB.

The graphical support provided by MATLAB is extremely powerful.It is easy to generate graphs such as histograms and box plots easily using MATLAB and Octave.

- MATLAB and Octave are the languages for technical computing.This helps in mathematical computations, modelling, simulations, data analysis and processing,visualization & graphics and algorithms development.
- The MATLAB environment allows the user to manage thousands of variables, help moving the data, develop and manage script files with MATLAB.

### The Disadvantage of using MATLAB

MATLAB is highly expensive. Though people use unlicensed copies of software but that is not the preferred way to use the tool. MATLAB is also slow compared to other programming languages. In order to make it easily accessible to anyone in world, there is an open source distribution Octave. Octave is similar to MATLAB and accepts almost all sorts of code which we want to run on MATLAB. It is cheaper to use Octave for prototyping and academic purposes. There are big companies which use Octave heavily for their internal coding purposes.

### Analytics Using MATLAB and Octave

The data science field is not restricted to Python or R. A data scientist has dozens of tools at his disposable which he can use to write big applications and also for prototyping. After taking an online class of Machine learning conducted by Stanford University’s professor Andrew NG, I got to know that Octave is the preferred programming environments for prototyping Machine learning algorithms. For example, if you have two different sounds mixed with one another, you can separate the two sounds from each other using just one line of code as following:

[crayon-5bc5ba63a3dce439774003/] Readers who are interested to know how this line of code works, they should go deeper for speech recognition API’s of MATLAB and Octave. I have started a series of programming tutorials on MATLAB and Octave so that users who are getting started with machine learning and analytics, can also add a tool to their skillset. Apart from introduction part, you can easily follow along the tutorials and I am sure within no time you will be running the MATLAB and octave on your system.### What are the Prerequisites of Getting Started

There are no prerequisites of using this tutorial series. You can just follow along, take the code, run it in your interpreter and see the output. This red-experiment-understand approach will make you an expert with in a short span of time and you will be ready to crunch the data very soon. It is good if you experience in any programming language such as C,C++, Python or Java.

Many of the concepts will be used here as well. So your knowledge is not going to be wasted. Some level of understanding of linear algebra is required as you will be working with Matrices, Vectors, Inverse matrix and their transposes as well. It is also good to have some statistics knowledge under your belt,as you will be exposed to various functions related to hypothesis testing, regression and descriptive statistics.

### Where to Download MATLAB and Octave

If you are a business and want to build heavy applications, then you should definitely consider purchasing the MATLAB license otherwise you can download the open source octave distribution using this download link.

### What Will Be Covered in This Series

In this MATLAB and Octave series we will cover below topics:

- Introduction to MATLAB and getting started lessons
- Manipulation of Matrix: The building blocks of MATLAB and learn more about 1D and 2D arrays
- How Loops work in MATLAB and octave
- We will learn about conditional statements and nested looping
- How to create user defined functions?
- How to generate graphs and plots

### How the Screen Will look like

For those who have installed MATLAB, here is a description of MATLAB workspace which includes:

**Editor Window:**This is where you write your code in the scripting file.**Workspace window:**This displays all the variables which you create in your namespace.**Command Window:**This is where you can directly execute the commands without writing them in a file.**Current Directory Window:**This will show all files and folders in the current directory.

### How to Get Help In MATLAB

You can use help or doc command with any function. For example, if I want to find help on pinv function which ius used to find the inverse matrix of any matrix, if exists.

[crayon-5bc5ba63a3ddc527430728/]### Basics to Help You Get Started

- You always need to type a command next to the prompt.
- To insert comments before the line or inline always use percentile sign. For example- % this is a comment.
- As soon as you execute any command, MATLAB will run it instantly and display the output. If you don’t want to display the output, use a semicolon(;) at the end of line.
- Use
**clc**command to clear the command window. - To display the variables in memory use
**who**command. You can also use**whos**command which will display all the variables along with other details such as their size also. - Use clear command to clear the variables from namespace. For example, if you want to delete the variable x from memory, use
**clear x**or if you want to clear the whole namespace, just type**clear.**

### What is a Script File

Script file is a file where you store your MATLAB or Octave commands so that it becomes a whole program. All commands are executed in the linear order. In case, you see a red mark in line, that indicates that there is an error in your code. These script files are called M- files and have **extension .m**.

### Basic Arithmetic Operations

[crayon-5bc5ba63a3de1678884130/]### What is the Order of Precedence

This tutorial already assumes that you have basic knowledge of order of precedence. Here is the order of precedence in context of operators which is followed in MATLAB and Octave programming languages.

[crayon-5bc5ba63a3de5640678221/]

### Relational Operators

[crayon-5bc5ba63a3de8440637866/]### What are Identifiers

- All the words that build the program such as himax,matlab_tutorial etc.
- Identifiers should not start with digits.
- Should not be a reserved word such as pi, NaN,eps, inf etc
- Maximum length should not be more than 63 characters.

### Display Formats

You can customize the output of the commands by defining the format at the beginning of the program. Few important commands are:

[crayon-5bc5ba63a3dec203619149/]