SlideShare a Scribd company logo
By
Md. Rakibul Hasan (Rakib)
M.Sc & B.Sc in EEE, KUET
E-mail: rakibul.eeekuet@gmail.com
Workshop on MATLAB and SIMULINK
 Command
Window
 Workspace
 Current
Folder
Built-in Funtions: sin, cos, sqrt, abs, ceil, isprime, gcd,
lcm, find, rot90, size, length, isempty, isequal and so on

 For instance, if you want to know more about the sin function, you can type:
help sin
or better yet:
doc sin
which opens up an indexed help window with further details about sin.
 Command: edit <filename>.m
 An m-file, or script file is a simple text file
 You can place MATLAB commands there instead of using command window
 Save your works
 Objects (e.g. data, text, color) in MATLAB is represented by matrices.
 Scalar: s=5
 Vector: a=[1 2 3]; %row vector
b=[4;5;6]; %column vector
c=1:5 %row vector
 Matrix: mat=[1 2 3; 4 5 6; 7 8 9]
% Use percent sign for comments
% Suppress output by adding a semicolon at the end of that command
Function Description
zeros(i,j) creates an i x j matrix of all zeros
ones(i,j) creates an i x j matrix of all ones
rand(i,j) creates an i x j matrix of random elements (between 0 and 1)
eye(i)
creates an i x i identity matrix (a matrix of zeros with ones on
the diagonal)
*Slide Courtesy: https://www.bu.edu/tech/files/2017/01/intro_matlab_2017Spring.pdf
Find Difference between:
 a*b & a.*b
 a/b & a./b
 a^3 & a.^3
*Slide Courtesy: https://www.bu.edu/tech/files/2017/01/intro_matlab_2017Spring.pdf
Expression Result Description
5:10 ans = 5 6 7 8 9 10 Values 5 to 10.
10:-1:5 ans = 10 9 8 7 6 5 Values 10 to 5 (using decrement of 1)
b(1:2,3:4)ans = 3 4 n 7 8 Row 1 to 2, Column 3 to 4
b(:)
ans = 1 5 9 13 2 6 10 14
3 7 11 15 4 8 12 16
Produces one long column, which is a concatenation of the
individual columns.
b(5:8) ans = 2 6 10 14
It is a concatenation of one column after the other. In this case,
you are getting the values of the second column.
b(end) ans = 16
end is a special value which indicates the end of the matrix. You
could have also written b(end,end) to specify the ending row and
the ending column.
b(1:4,4) ans = 4 8 12 16
This gets the values of the last column (rows 1 to 4 and column
4). Since you are specify all rows and the final column, you could
also use the notation: b(1:end,end) or the colon operator on its
own, which specifies the entire range of rows b(:,end)
b(end:-
1:1,:)
ans = 13 14 15 16 9 10
11 12 5 6 7 8 1 2 3 4
Reverses the order of the rows so that the last row is first and the
first row is last. Read this as: Rows last to first with a decrement
of 1 (end:-1:1) and all columns(:)
b=[1
2
3
4;5
6
7
8;
9
10
11
12;13
14
15
16]
*Slide Courtesy: https://www.bu.edu/tech/files/2017/01/intro_matlab_2017Spring.pdf
*Slide Courtesy: https://www.bu.edu/tech/files/2017/01/intro_matlab_2017Spring.pdf
*Slide Courtesy: https://www.bu.edu/tech/files/2017/01/intro_matlab_2017Spring.pdf
*Slide Courtesy: https://www.bu.edu/tech/files/2017/01/intro_matlab_2017Spring.pdf
i
*Slide Courtesy: https://www.bu.edu/tech/files/2017/01/intro_matlab_2017Spring.pdf
*Slide Courtesy: https://www.bu.edu/tech/files/2017/01/intro_matlab_2017Spring.pdf
*Slide Courtesy: https://www.bu.edu/tech/files/2017/01/intro_matlab_2017Spring.pdf
*Slide Courtesy: https://www.bu.edu/tech/files/2017/01/intro_matlab_2017Spring.pdf
Graphing functions MATLAB command
Label the horizontal axis. xlabel('text')
Label the vertical axis. ylabel('text')
Attach a title to the plot. title('text')
Change the limits on the x and y axis. axis([xmin xmax ymin ymax])
"Keep plotting in the same window." hold on
Turn off the "keep-plotting-in-the-
same-window-command".
hold off
 Two ways to plot figures: mouse-operation vs. scripting.
Type doc plot on Command Window
*Slide Courtesy: https://www.bu.edu/tech/files/2017/01/intro_matlab_2017Spring.pdf
*Slide Courtesy: https://www.bu.edu/tech/files/2017/01/intro_matlab_2017Spring.pdf
*Slide Courtesy: https://www.bu.edu/tech/files/2017/01/intro_matlab_2017Spring.pdf
1. Plot sin(x) on the interval [-pi,pi] using spacing 0.5, 0.1 and 0.01 between
the points where you will sample the function.
2. Attach labels to the axis of the previous plot and give a title to the graph.
3. Plot 5cos(đ‘„2+1) on [-2pi,2pi].
https://www.coursera.org/learn/matlab
Introduction to Programming with MATLAB
 Coursera online course:
 Mathworks File Exchange:
https://www.mathworks.com/matlabcentral/fileexchange/

More Related Content

PDF
Feel++ webinar 9 27 2012
PDF
MathML: onde estamos?
 
PPTX
Exercise6 ch2
 
PDF
Data Visualization With R: Learn To Combine Multiple Graphs
PDF
Data Visualization With R: Introduction
DOC
Alv Grids
PDF
Introduction to MATLAB - I
PDF
MBrace: Cloud Computing with F#
Feel++ webinar 9 27 2012
MathML: onde estamos?
 
Exercise6 ch2
 
Data Visualization With R: Learn To Combine Multiple Graphs
Data Visualization With R: Introduction
Alv Grids
Introduction to MATLAB - I
MBrace: Cloud Computing with F#

What's hot (6)

PDF
Data Visualization With R: Learn To Modify Color Of Plots
DOCX
Image Processing using Matlab ( implement sub sampling and re sampling functi...
PPTX
CS 151 CSV output
PPTX
2 19-2018-mean of all runs
PDF
Lecture 1 python arithmetic (ewurc)
PPTX
Space complexity
Data Visualization With R: Learn To Modify Color Of Plots
Image Processing using Matlab ( implement sub sampling and re sampling functi...
CS 151 CSV output
2 19-2018-mean of all runs
Lecture 1 python arithmetic (ewurc)
Space complexity
Ad

Similar to Workshop on MATLAB and SIMULINK (20)

PDF
Matlab ch1 intro
PPTX
Basic of octave matlab programming language
PPTX
Introduction to matlab
PDF
MATLAB Questions and Answers.pdf
PDF
Matlab intro notes
PDF
Complier Design - Operations on Languages, RE, Finite Automata
PDF
Introduction to matlab
PDF
Introduction to matlab
PPTX
Computation Assignment Help
DOCX
Cs6660 compiler design november december 2016 Answer key
PDF
2nd Semester M Tech: Structural Engineering (June-2015) Question Papers
PPTX
Computational Assignment Help
DOCX
educational course/tutorialoutlet.com
DOCX
B61301007 matlab documentation
PDF
Functional Smalltalk
 
PDF
Laboratory 7
PPT
Matlab practical and lab session
DOCX
Name _______________________________ Class time __________.docx
PDF
Automatic and Interpretable Machine Learning with H2O and LIME
PDF
Mcs 011 ignou question paper c language
Matlab ch1 intro
Basic of octave matlab programming language
Introduction to matlab
MATLAB Questions and Answers.pdf
Matlab intro notes
Complier Design - Operations on Languages, RE, Finite Automata
Introduction to matlab
Introduction to matlab
Computation Assignment Help
Cs6660 compiler design november december 2016 Answer key
2nd Semester M Tech: Structural Engineering (June-2015) Question Papers
Computational Assignment Help
educational course/tutorialoutlet.com
B61301007 matlab documentation
Functional Smalltalk
 
Laboratory 7
Matlab practical and lab session
Name _______________________________ Class time __________.docx
Automatic and Interpretable Machine Learning with H2O and LIME
Mcs 011 ignou question paper c language
Ad

More from Md Rakibul Hasan (6)

PPTX
An Evolutionary-based Neural Network for Distinguishing between Genuine and P...
PPTX
Outcomes of Deep Neural Network Hyperparameter Tuning on Bengali Speech Token...
PPTX
Investigation of the Effect of MFCC Variation on the Convolutional Neural Net...
PPTX
IoT Based Smart Energy Management in Residential Applications
PPTX
E-health and agri-digitization in Bangladesh
PPTX
PIR triggered camera using Raspberry Pi
An Evolutionary-based Neural Network for Distinguishing between Genuine and P...
Outcomes of Deep Neural Network Hyperparameter Tuning on Bengali Speech Token...
Investigation of the Effect of MFCC Variation on the Convolutional Neural Net...
IoT Based Smart Energy Management in Residential Applications
E-health and agri-digitization in Bangladesh
PIR triggered camera using Raspberry Pi

Recently uploaded (20)

PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPT
Introduction Database Management System for Course Database
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Nekopoi APK 2025 free lastest update
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Digital Strategies for Manufacturing Companies
PPTX
Introduction to Artificial Intelligence
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
System and Network Administration Chapter 2
PDF
top salesforce developer skills in 2025.pdf
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
System and Network Administraation Chapter 3
Adobe Illustrator 28.6 Crack My Vision of Vector Design
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Introduction Database Management System for Course Database
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
Odoo Companies in India – Driving Business Transformation.pdf
Nekopoi APK 2025 free lastest update
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Wondershare Filmora 15 Crack With Activation Key [2025
VVF-Customer-Presentation2025-Ver1.9.pptx
Understanding Forklifts - TECH EHS Solution
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Digital Strategies for Manufacturing Companies
Introduction to Artificial Intelligence
How to Migrate SBCGlobal Email to Yahoo Easily
System and Network Administration Chapter 2
top salesforce developer skills in 2025.pdf
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Computer Software and OS of computer science of grade 11.pptx
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
System and Network Administraation Chapter 3

Workshop on MATLAB and SIMULINK