SlideShare a Scribd company logo
1 of 25
By
Md. Rakibul Hasan (Rakib)
M.Sc & B.Sc in EEE, KUET
E-mail: rakibul.eeekuet@gmail.com
 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

What's hot (6)

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

Similar to Workshop on MATLAB and SIMULINK

Matlab practical and lab session
Matlab practical and lab sessionMatlab practical and lab session
Matlab practical and lab session
Dr. Krishna Mohbey
 
Name _______________________________ Class time __________.docx
Name _______________________________    Class time __________.docxName _______________________________    Class time __________.docx
Name _______________________________ Class time __________.docx
rosemarybdodson23141
 
27.2.9 lab regular expression tutorial
27.2.9 lab   regular expression tutorial27.2.9 lab   regular expression tutorial
27.2.9 lab regular expression tutorial
Freddy Buenaño
 

Similar to Workshop on MATLAB and SIMULINK (20)

Matlab ch1 intro
Matlab ch1 introMatlab ch1 intro
Matlab ch1 intro
 
Basic of octave matlab programming language
Basic of octave matlab programming languageBasic of octave matlab programming language
Basic of octave matlab programming language
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
MATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdfMATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdf
 
Matlab intro notes
Matlab intro notesMatlab intro notes
Matlab intro notes
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Computation Assignment Help
Computation Assignment Help Computation Assignment Help
Computation Assignment Help
 
Cs6660 compiler design november december 2016 Answer key
Cs6660 compiler design november december 2016 Answer keyCs6660 compiler design november december 2016 Answer key
Cs6660 compiler design november december 2016 Answer key
 
2nd Semester M Tech: Structural Engineering (June-2015) Question Papers
2nd  Semester M Tech: Structural Engineering  (June-2015) Question Papers2nd  Semester M Tech: Structural Engineering  (June-2015) Question Papers
2nd Semester M Tech: Structural Engineering (June-2015) Question Papers
 
Computational Assignment Help
Computational Assignment HelpComputational Assignment Help
Computational Assignment Help
 
educational course/tutorialoutlet.com
educational course/tutorialoutlet.comeducational course/tutorialoutlet.com
educational course/tutorialoutlet.com
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
 
Functional Smalltalk
Functional SmalltalkFunctional Smalltalk
Functional Smalltalk
 
Laboratory 7
Laboratory 7Laboratory 7
Laboratory 7
 
Matlab practical and lab session
Matlab practical and lab sessionMatlab practical and lab session
Matlab practical and lab session
 
Name _______________________________ Class time __________.docx
Name _______________________________    Class time __________.docxName _______________________________    Class time __________.docx
Name _______________________________ Class time __________.docx
 
Automatic and Interpretable Machine Learning with H2O and LIME
Automatic and Interpretable Machine Learning with H2O and LIMEAutomatic and Interpretable Machine Learning with H2O and LIME
Automatic and Interpretable Machine Learning with H2O and LIME
 
Mcs 011 ignou question paper c language
Mcs 011 ignou question paper c languageMcs 011 ignou question paper c language
Mcs 011 ignou question paper c language
 
27.2.9 lab regular expression tutorial
27.2.9 lab   regular expression tutorial27.2.9 lab   regular expression tutorial
27.2.9 lab regular expression tutorial
 

More from Md Rakibul Hasan

More from Md Rakibul Hasan (6)

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

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Recently uploaded (20)

Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 

Workshop on MATLAB and SIMULINK