MATLAB Basic Course
Lectured by
Dr. Thandar Oo (Prince of Songkla University,
PSU, Thailand)
Former Data Scientist at Toyota Tsusho Nexty
Electronics, Bangkok
1
2
Overview of MATLAB
Change the path/URL
3
Continued
4
Continued
5
Continued
6
Continued
7 Continued
clear all = clear variables in Workspace
close all = close all figures
clc = clear screen/command window
8 Continued
*Case sensitive*
9
Continued
; = Hide the answer in Command Window
10
Introduction to Matrices
11
Continued
12 Continued
5 Rows, 2 Columns
13 Continued
14 Continued
15 Continued
M = magic(n) returns
an n -by- n matrix
constructed from the
integers 1 through n^2
with equal row and
column sums
16 Continued
17 Continued
18
Continued
19
Continued
20 Complex Numbers
0.0000 = real value
1.0000 = imaginary value
21
Continued
22
Array Indexing
23
Continued
Continued
24
25
Continued
26
Continued
27
Save Variables
.mat
Continued
28
Loading Variables
29
load = recall the variables
Continued
30
31
Plotting 2D Graph
Continued
32
33
Continued
34
label and title
35
Change Background
Continued
36
37
Continued
38
Change Line Color
39
Change Line Style
40
Continued
Plotting multiple graph
41
Hold on
42
Hold off
legend
43
Conclusions
Overview of MATLAB
Introduction to Matrices
Complex Numbers
Save Variables and Load Variables
Plotting 2D Graph and Plotting multiple graph
44
Exercises
1. Plot “cos,tan,cot,sec,cosec” with 2D graph and multiple graph.
2. Create a matrix 7x7.And then,Create magic (7). Then, combine
these two matrix.
3. Create an array of ones and zeros. Then, combine them.
Thank you for your Attention!!!
45
Appendix
46
47 MATLAB Syntax
48
MATLAB Commands
49
Continued
Continued
50
51
Continued
52
MATLAB Colors and Style