1 of 24

Use of MATLAB in food industry; computing with MATLAB, script files and editor/debugger, MATLAB help system, problem solving methodologies, numeric, cell, arrays, matrix operations, user defined functions, programming using MATLAB; debugging MATLAB programs, applications to simulations

COM 103 ICT Applications in Food Industry (1+2)

Lecture Schedule 5

Dr. S. Sridevy, Ph.D.

Assistant Professor (Computer Science)

Dept. of Physical Sciences & IT

AEC&RI, TNAU, Coimbatore – 3.

23 June 2021

2 of 24

Overview

  • MATLAB in food industry
  • MATLAB Introduction
  • MATLAB working environment

S. Sridevy

23 June 2021

3 of 24

What is MATLAB?

  • Matlab is a programming language similar to other well-known languages such as Java, C#, etc., which comes with its own IDE (that is Integrated Development Environment) and set of libraries.
  • Matlab is an abbreviation of the term “Matrix Laboratory” since it was initially referred to as the matrix programming language.

S. Sridevy

23 June 2021

4 of 24

What is MATLAB? (Contd.)

  • It is a fourth-generation programming language.
  • Discovered by Cleve Moler, who at the time was the Chairman of the Computer Science department at the University of New Mexico.
  • His goal was to find an alternative way to perform linear algebra and numerical computation for his students without them having to use Fortran.

S. Sridevy

23 June 2021

5 of 24

What is MATLAb? (Contd.)

  • Later in 1984, Cleve Molar along with Steve Bangart and Jack Little – who recognized Matlab’s commercial potential, found MathWorks.
  • MathWorks released its first official version of Matlab in 1984.

S. Sridevy

23 June 2021

6 of 24

What is MATLAB? (Contd.)

  • MATLAB is an interactive and mathematical computing programming environment, widely used in the field of data pre-processing, data analysis, exploration, experimentation, algorithm development, application development, problem solving and visualization. 

S. Sridevy

23 June 2021

7 of 24

What is MATLAB? (Contd.)

  • MATLAB functions are organized in the form of libraries known as Toolbox.
  • MATLAB provides ample of features such as ease of use, no variable declaration, complex matrices handling, easily used graphics, concise syntax etc., which distinguishes it from other scientific programming languages such as C and FORTRAN.

S. Sridevy

23 June 2021

8 of 24

Uses of MATLAB

  • Performing numerical linear algebra
  • Numerical computation of Matrices
  • Data analysis and visualization
  • Plotting graphs for larger data sets
  • Developing algorithms
  • Creating interfaces for the user that is the GUI- Graphical User Interface and other applications that is the API – Application Programming Interface

S. Sridevy

23 June 2021

9 of 24

Features of MATLAB

  • High-Level Language
  • Interactive Environment
  • Handling Graphics
  • Mathematical Functions Library
  • Application Program Interface (API)
  • Toolboxes
  • Accessing Data
  • Interfacing with Other Languages
  • Data Processing
  • Machine Learning, Neural Networks, Beyond Statistics
  • Text Analytics
  • Multi-Platform Deployment

S. Sridevy

23 June 2021

10 of 24

MATLAB Versions

  • There are more than 50 Matlab versions released from 1984 to till date.
  • Matlab 1.0 was the first version released in The Year 1984. However recent versions are written in C, C++, and Java.
  • Mathworks recently released Matlab R2020a version.

S. Sridevy

23 June 2021

11 of 24

MATLAB Versions

  • MATLAB 1.0
  • MATLAB 2
  • MATLAB 3……….
  • MATLAB 9.5 R2018a
  • MATLAB 9.6 R2019a
  • MATLAB 9.7 R2019b…….R2021a

S. Sridevy

23 June 2021

12 of 24

MATLAB Desktop

S. Sridevy

23 June 2021

13 of 24

MATLAB Desktop (Contd.)

  • The desktop includes these panels:
  • Current Folder — Access your files.
  • Command Window — Enter commands at the command line, indicated by the prompt (>>).
  • Workspace — Explore data that you create or import from files.

S. Sridevy

23 June 2021

14 of 24

MATLAB Variables

  • All MATLAB variables are multidimensional arrays, no matter what type of data.
  • matrix is a two-dimensional array often used for linear algebra.

S. Sridevy

23 June 2021

15 of 24

Array Creation

  • a = [1 2 3 4]

a =  1 2 3 4 

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

S. Sridevy

23 June 2021

16 of 24

Array Creation (Contd.)

  • Another way to create a matrix is to use a function, such as ones, zeros, or rand. For example, create a 5-by-1 column vector of zeros.

S. Sridevy

23 June 2021

17 of 24

Matrix and Array Operations

  • MATLAB allows to process all of the values in a matrix using a single arithmetic operator or function.

S. Sridevy

23 June 2021

18 of 24

Matrix and Array Operations (Contd.)

  • sin value of a matrix

S. Sridevy

23 June 2021

19 of 24

Matrix and Array Operations (Contd.)

  • To transpose a matrix, use a single quote ('):

S. Sridevy

23 June 2021

20 of 24

Matrix Operation (Contd.)

  • Matrix multiplication using single * operator:

S. Sridevy

23 June 2021

21 of 24

Format Command

  • Reset the display to the shorter format using
    • format short
    • format affects only the display of numbers, not the way MATLAB computes or saves them.

S. Sridevy

23 June 2021

22 of 24

Element-wise multiplication

  • To perform element-wise multiplication rather than matrix multiplication, use the .* operator:

S. Sridevy

23 June 2021

23 of 24

Element wise Operations

  • The matrix operators for multiplication, division, and power each have a corresponding array operator that operates element-wise.
  • For example, raise each element of a to the third power

S. Sridevy

23 June 2021

24 of 24

Concatenation

  • Concatenation is the process of joining arrays to make larger ones.

S. Sridevy

23 June 2021

Thank You!