INTRODUCTION TO MATLAB Lecture 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Subject: Introduction to Computing

Topic: Matlab @ Introduction


Teacher: Dr. Ajeet Kumar
What is MATLAB??
• It is a software package/ language developed to ease the
complicated numerical computation
• The Matlab language was created by Prof. Cleve B.
Moler, Professor of Computer Science (a specialist in
numerical analysis) at the University of New Mexico.
• It has since spawned several commercial and open-
source derivatives of the original matlab language.
• Today, the premier commercial version is MATLAB
(R) by The Mathworks, Inc., and the best free, open-
source version appears to be Octave.
• https://in.mathworks.com/
What is MATLAB??
• MATLAB stands for MAT + LAB
MAT = MATRIX
LAB = LABORATORY
Matlab stands for matrix laboratory
• All the calculations done in MATALB is in form
of matrices.
• It creates ease in calculations of Matrix operation
in comparison of others existing software and
programming languages
Features of MATLAB
• Inbuilt functions
– inv, eig, roots, quad, triplequad, besselj, fzero
• User defined function
– You can define your own program similar to inbuilt
function
• Ease in computation work
– Linear algebra
– Solving differential equations
– Data analysis
– Interpolation and curve fitting
Features of MATLAB
• Toolbox
– Simulink
– Image processing
– Neural Networks
– Bioinformatics
• Possibility of external interfacing with other
programming languages (C, C++ and Fortran etc)

• Efficient Graphical Unser Interface (GUI)


– Create ease in analysing the results
Features of MATLAB
• Data Handling
– Data handling is much easier in MALTAB
– Matrix Operation and Array Operation both can be handled with ease
just by using different operators.
– No need to define type of variable ( REAL, INTEGER OR
COMPLEX)
– No need to define dimension of array
– No need to define single precession or double precession for
calculation

• Limitation
– Symbolic calculation: It also support symbolic calculation but with
certain limitation.
– Mathematica Software is Software used for strong and efficient
symbolic calculation
MATLAB LAYOUT
Default Layout of MATLAB
• Address bar
• Current folder
– Show all folders and files
• Command Window
– Starts with “ >>”” , all commands execute here !!
• Command History
– Show all previous commands with date
• Workspace
– Display all of the variable
• Layout can be changes as per user’s choice using
“Layout” option
File Type
• There are mainly three types of file in
MATLAB
– M-files
– MAT-files
– MEX-files
File Type
• M-files
– M-files are standard ASCII text files.
– File name of M-files are with extension (.m).
– Any program written in a MATLAB editor is
saved as M-files.
– These files are further classified as
• Script file
• Function file
File Type
• Script file
– It is a file written in matlab editor to solve the given
problem and saved with extension .m
» File can be executed by two ways
• Typing file name in command window (Be
careful about folder location)
• Using the icon RUN ( ) provided in
MATLAB
File Type
• Function file
– It is a file written in matlab editor using special
syntax
– Function file can be used called in other
script/function file
– Saved with extension .m
– Function file can be executed by writing file name
and required input parameters
– Details of function file will be discussed in coming
session
File Type
• MAT-files
– MAT-file is binary file used to save the data.
– Thus it is recognized as Data File
– MAT-file can be read by MATLAB environment
– Save with extension “.mat”
– MAT-files are double-precision MATLAB format files.
– They can be created on one machine and later read by
MATLAB on another machine with a different floating-point
format, retaining as much accuracy and range as the different
formats allow.
– They can also be manipulated by other programs external to
MATLAB.
– Working of MAT-files will be discussed in coming lectures
File Type
• MEX-files
– A MEX file is a function, created in MATLAB,
that calls a C/C++ program or a Fortran
subroutine. A MEX function behaves just like
a MATLAB script or function.
– Students are advised to read about this as per their
own interest.
OUTPUT DISPLAY
• format
– format long: Display 15 places after decimal
– format short: Display 4 places after decimal
– format long e: Display 15 places after decimal
followed by exponential
– format short e: Display 4 places after decimal
followed by exponential
– format long g: Total 15 digits
– format short g: Total 5 digits

You might also like