2. INTRODUCTION
18/11/2021
Cleve molar in 1984, Mathworks
inc
Introduced as a simulation tool
Supports Graphical Programming
Can be interfaced with other High
Level languages
3. WHAT IS MATLAB?
MATLAB is a program for doing numerical computation. It
was originally designed for solving linear algebraic type
problems using matrices. It’s name is derived from MATrix
LABoratory
Difference between C and Matlab
Inbuilt Functions in Matlab (Application Oriented)
User friendly syntax
Fourth generation Programming Language tool
18/11/2021
4. FEATURES
MATLAB is a software package for high performance
numerical computation and visualization
Manipulating and plotting data
Especially large data sets
Scientific computing
Dynamic system modeling
System design
18/11/2021
5. FEATURES
cont..
MATLAB provides an interactive environment with
hundreds of reliable and accurate built-in mathematical
functions
Mathematical problems including matrix algebra, complex
arithmetic, linear systems, differential equations, signal
processing, optimization, nonlinear systems, etc.,
The most important feature of MATLAB is its programming
capability, which is very easy to learn and to use, and also
allows user-developed functions
18/11/2021
6. MEMORY ALLOCATION
No need for types. i.e.,
All variables are created with double precision unless
specified and they are matrices.
18/11/2021
int a;
double b;
float c;
Example:
>>x=5;
>>x1=2;
8. EDITOR WINDOW
18/11/2021
Click to
create a new
M-File
Extension “.m”
A text file
containing script or
function or
program to run
edit<space> <function name>
• To understand the code sequence
• Editing can‘t be done for some Functions
10. CODE ANALYZER
• It helps in debugging the error
• Types of errors
1. Functional error
linespace instead of linspace
18/11/2021
Error
How to
Avoid?
Functional Error
11. CODE ANALYZER
2. Syntax Error
imread(“___”) instead of imread(‘___’)
18/11/2021
Error
How to
Avoid?
Contd…
13. SIMULINK
SIMULINK is a graphical mouse-driven program for
the simulation of dynamic systems.
SIMULINK enables students to simulate linear, as
well as nonlinear, systems easily and efficiently.
18/11/2021
16. MATLAB WINDOWS
• Command Window
– type commands
• Current Directory
– View folders and m-files
• Workspace
– View program variables
– Double click on a variable
to see it in the Array Editor
• Command History
– view past commands
– save a whole session
using diary
18/11/2021
17. MATLAB as a calculator
18/11/2021
BASIC MATLAB FUNCTIONS
18. VECTORS
a = [1 2 3 4 5 6 9 8 7] ;
t = 0:2:20
t = 0 2 4 6 8 10 12 14 16 18 20
b = a + 2
b = 3 4 5 6 7 8 11 10 9
c = a + b
c = 4 6 8 10 12 14 20 18 16
18/11/2021
19. MATRICES
B = [1 2 3 4;5 6 7 8;9 10 11 12] ;
B = 1 2 3 4
5 6 7 8
9 10 11 12
C = B'
C = 1 5 9
2 6 10
3 7 11
4 8 12
18/11/2021
20. BASIC MATRIX OPERATORS
X = inv(E) ;%INVERSE OF THE MATRIX
[A,H] = eig(E) %eigen value &vector
p = poly(E) %polynomial
c = abs(y) ;
D=min(a);
D=max(a);
Convolution
x = [1 2];
y = [1 4 8];
z = conv(x,y)
[xx, R] = deconv(z,y)
18/11/2021