SlideShare a Scribd company logo
2
Most read
3
Most read
17
Most read
Introduction to Matlab By: TARIQ
MATLAB Stands for MATrix LABoratory. program for doing numerical computation. originally designed for solving linear algebra type problems using matrices.
MATLAB The MATLAB environment is command oriented somewhat like UNIX.  A prompt appears on the screen and a MATLAB statement can be entered. When the <ENTER> key is pressed, the statement is executed, and another prompt appears. If a statement is terminated with a semicolon ( ; ), no results will be displayed.  Otherwise results will appear before the next prompt.
Matlab Screen 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
MATLAB Variable Names Variable names ARE case sensitive Variable names can contain up to 63 characters. Variable names must start with a letter followed by letters, digits, and underscores.
MATLAB Special Variables ans Default variable name for results pi Value of   eps Smallest incremental number inf Infinity NaN Not a number e.g.  0/0 i and j i = j = square root of -1 realmin The smallest usable positive real number realmax The largest usable positive real number
MATLAB To get started, type one of these commands: helpwin, helpdesk, or demo » a=5; » b=a/2 b = 2.5000 »
MATLAB Math & Assignment Operators Power ^ or .^ a^b or   a.^b Multiplication *  or .* a*b or a.*b Division / or ./ a/b or a./b or \ or .\ b\a or b.\a NOTE:  56/8 = 8\56 -  (unary)  +  (unary) Addition +   a + b Subtraction -    a - b Assignment = a = b   (assign  b  to  a )
Other MATLAB symbols >> prompt . . . continue statement on next line , separate statements and data % start comment which ends at end of line ; (1) suppress output (2) used as a row separator in a matrix : specify range
MATLAB Matrices MATLAB treats all variables as matrices.  For our purposes a matrix can be thought of as an array, in fact, that is how it is stored.  Vectors are special forms of matrices and contain only one row OR one column. Scalars are matrices with only one row AND one column
MATLAB Matrices A matrix with only one row AND one column is a scalar.  A scalar can be created in MATLAB as follows: » a_value=23 a_value = 23
MATLAB Matrices A matrix can be created in MATLAB as follows (note the commas AND  semicolons): » matrix = [1 , 2 , 3  ;  4 , 5  ,6  ;  7 , 8 , 9] matrix = 1  2  3 4  5  6 7  8  9
MATLAB Matrices A column vector can be extracted from a matrix.  As an example we create a matrix below: » matrix=[1,2,3;4,5,6;7,8,9] matrix = 1  2  3 4  5  6 7  8  9 Here we extract column 2 of the matrix and make a column vector: » col_two=matrix( : , 2) col_two = 2 5 8
Plotting with MATLAB MATLAB will plot one vector vs. another.  The first one will be treated as the abscissa (or x) vector and the second as the ordinate (or y) vector.  The vectors have to be the same length. MATLAB will also plot a vector vs. its own index.  The index will be treated as the abscissa vector. Given a vector “time” and a vector “dist” we could say: >> plot (time, dist)  % plotting versus time  >> plot (dist) % plotting versus index
Plotting with MATLAB There are commands in MATLAB to &quot;annotate&quot; a plot to put on axis labels, titles, and legends.  For example: >> % To put a label on the axes we would use: >> xlabel ('X-axis label') >> ylabel ('Y-axis label') >> % To put a title on the plot, we would use: >> title ('Title of my plot')
Some Useful MATLAB commands who List known variables whos List known variables plus their size help >> help sqrt  Help on using sqrt lookfor >> lookfor sqrt  Search for   keyword sqrt in m-files what  >> what a:  List MATLAB files in a: clear Clear all variables from work space clear x  y Clear variables x and y from work space clc Clear the command window
Some Useful MATLAB commands what List all m-files in current directory dir List all files in current directory ls Same as dir type test Display test.m in command window delete test Delete test.m cd  a: Change directory to a: chdir a: Same as cd pwd Show current directory which test Display directory path to ‘closest’ test.m
A Useless, But Interesting, MATLAB command why In case you ever needed a reason
MATLAB Relational Operators MATLAB supports six relational operators.  Less Than < Less Than or Equal <= Greater Than > Greater Than or Equal >= Equal To == Not Equal To ~=
MATLAB Logical Operators MATLAB supports three logical operators. not ~ % highest precedence and & % equal precedence with or or  | % equal precedence with and
MATLAB Toolboxes Signal & Image Processing Signal Processing Image Processing Communications   Frequency Domain System Identification Higher-Order Spectral Analysis System Identification Wavelet Filter Design   Control Design  Control System Fuzzy Logic Robust Control μ-Analysis and Synthesis Model Predictive Control Intro MATLAB Math and Analysis Optimization Requirements Management Interface Statistics Neural Network Symbolic/Extended Math Partial Differential Equations PLS Toolbox Mapping Spline Data Acquisition and Import Data Acquisition Instrument Control Excel Link Portable Graph Object
Thanks

More Related Content

PPTX
Matlab Introduction
PPTX
Matlab ppt
PDF
Digital Image Processing: An Introduction
PPTX
Electric drive
PPSX
Introduction to MATLAB
PDF
MATLAB INTRODUCTION
PDF
Module4 s dynamics- rajesh sir
PPT
Electric drives
Matlab Introduction
Matlab ppt
Digital Image Processing: An Introduction
Electric drive
Introduction to MATLAB
MATLAB INTRODUCTION
Module4 s dynamics- rajesh sir
Electric drives

What's hot (20)

PDF
Introduction to matlab
PPT
Introduction to matlab
PPT
Introduction to Matlab
PPSX
Matlab basic and image
PDF
MATLAB Basics-Part1
PDF
Introduction to Matlab
PPTX
Introduction to matlab lecture 1 of 4
PPTX
Matlab ppt
PPT
Matlab Introduction
PPT
Introduction to MatLab programming
PPTX
Ai 8 puzzle problem
PPT
Matlab practical and lab session
PPT
Matlab Basic Tutorial
PPTX
Greedy algorithms
PDF
ADVANCED OPTIMIZATION TECHNIQUES META-HEURISTIC ALGORITHMS FOR ENGINEERING AP...
PPTX
Basic matlab and matrix
PPT
Introduction to matlab
PPT
Introduction to matlab
PDF
Naive Bayes
PPTX
Introduction to Dynamic Programming, Principle of Optimality
Introduction to matlab
Introduction to matlab
Introduction to Matlab
Matlab basic and image
MATLAB Basics-Part1
Introduction to Matlab
Introduction to matlab lecture 1 of 4
Matlab ppt
Matlab Introduction
Introduction to MatLab programming
Ai 8 puzzle problem
Matlab practical and lab session
Matlab Basic Tutorial
Greedy algorithms
ADVANCED OPTIMIZATION TECHNIQUES META-HEURISTIC ALGORITHMS FOR ENGINEERING AP...
Basic matlab and matrix
Introduction to matlab
Introduction to matlab
Naive Bayes
Introduction to Dynamic Programming, Principle of Optimality
Ad

Viewers also liked (17)

PPSX
Introduction to MATLAB
PDF
Matlab Presentation
PPTX
Introduction to MATLAB
PDF
Matlab Mech Eee Lectures 1
PPTX
Mat lab solving equations simulink
PDF
Simulink
PPT
Introduction to matlab
PPTX
An Introduction to MATLAB for beginners
PPTX
Matlab simulink introduction
PDF
MATLAB Programs For Beginners. | Abhi Sharma
PPSX
Induction Motor Tests Using MATLAB/Simulink
PDF
Matlab practice
PPTX
Introduction to matlab
PDF
PDF
Matlab Mech Eee Lectures 1
PPT
An introduction to FACTS
PPT
Power Flow in a Transmission line
Introduction to MATLAB
Matlab Presentation
Introduction to MATLAB
Matlab Mech Eee Lectures 1
Mat lab solving equations simulink
Simulink
Introduction to matlab
An Introduction to MATLAB for beginners
Matlab simulink introduction
MATLAB Programs For Beginners. | Abhi Sharma
Induction Motor Tests Using MATLAB/Simulink
Matlab practice
Introduction to matlab
Matlab Mech Eee Lectures 1
An introduction to FACTS
Power Flow in a Transmission line
Ad

Similar to Brief Introduction to Matlab (20)

PPT
MatlabIntro (1).ppt
PPTX
Matlab introduction
PPTX
From zero to MATLAB hero: Mastering the basics and beyond
PDF
Matlab guide
PPT
Introduction to Matlab.ppt
PDF
EE6711 Power System Simulation Lab manual
PPTX
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
PPT
Matlab anilkumar
DOC
Matlab tut2
PDF
interfacing matlab with embedded systems
PPTX
MATLAB : Introduction , Features , Display Windows, Syntax, Operators, Graph...
PPT
Matlab
PPT
MatlabIntro1234.ppt.....................
PDF
Introduction to MATLAB
PDF
A complete introduction on matlab and matlab's projects
PDF
DOC
Matlab summary
PPT
WIDI ediot autis dongok part 3.EDIOT LU LEMBOT LY
PPT
WIDI ediot autis dongok part 2.ediot lu lembot lu
PPT
WIDI FREAK MANUSIA SETENGAH EDIOTDAN LEMBOT
MatlabIntro (1).ppt
Matlab introduction
From zero to MATLAB hero: Mastering the basics and beyond
Matlab guide
Introduction to Matlab.ppt
EE6711 Power System Simulation Lab manual
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
Matlab anilkumar
Matlab tut2
interfacing matlab with embedded systems
MATLAB : Introduction , Features , Display Windows, Syntax, Operators, Graph...
Matlab
MatlabIntro1234.ppt.....................
Introduction to MATLAB
A complete introduction on matlab and matlab's projects
Matlab summary
WIDI ediot autis dongok part 3.EDIOT LU LEMBOT LY
WIDI ediot autis dongok part 2.ediot lu lembot lu
WIDI FREAK MANUSIA SETENGAH EDIOTDAN LEMBOT

Recently uploaded (20)

PPTX
sap open course for s4hana steps from ECC to s4
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPT
Teaching material agriculture food technology
PPTX
Big Data Technologies - Introduction.pptx
PDF
KodekX | Application Modernization Development
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Network Security Unit 5.pdf for BCA BBA.
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
sap open course for s4hana steps from ECC to s4
Empathic Computing: Creating Shared Understanding
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Teaching material agriculture food technology
Big Data Technologies - Introduction.pptx
KodekX | Application Modernization Development
Spectral efficient network and resource selection model in 5G networks
20250228 LYD VKU AI Blended-Learning.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
MYSQL Presentation for SQL database connectivity
Review of recent advances in non-invasive hemoglobin estimation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Approach and Philosophy of On baking technology
Mobile App Security Testing_ A Comprehensive Guide.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Network Security Unit 5.pdf for BCA BBA.
“AI and Expert System Decision Support & Business Intelligence Systems”

Brief Introduction to Matlab

  • 2. MATLAB Stands for MATrix LABoratory. program for doing numerical computation. originally designed for solving linear algebra type problems using matrices.
  • 3. MATLAB The MATLAB environment is command oriented somewhat like UNIX. A prompt appears on the screen and a MATLAB statement can be entered. When the <ENTER> key is pressed, the statement is executed, and another prompt appears. If a statement is terminated with a semicolon ( ; ), no results will be displayed. Otherwise results will appear before the next prompt.
  • 4. Matlab Screen 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
  • 5. MATLAB Variable Names Variable names ARE case sensitive Variable names can contain up to 63 characters. Variable names must start with a letter followed by letters, digits, and underscores.
  • 6. MATLAB Special Variables ans Default variable name for results pi Value of  eps Smallest incremental number inf Infinity NaN Not a number e.g. 0/0 i and j i = j = square root of -1 realmin The smallest usable positive real number realmax The largest usable positive real number
  • 7. MATLAB To get started, type one of these commands: helpwin, helpdesk, or demo » a=5; » b=a/2 b = 2.5000 »
  • 8. MATLAB Math & Assignment Operators Power ^ or .^ a^b or a.^b Multiplication * or .* a*b or a.*b Division / or ./ a/b or a./b or \ or .\ b\a or b.\a NOTE: 56/8 = 8\56 - (unary) + (unary) Addition + a + b Subtraction - a - b Assignment = a = b (assign b to a )
  • 9. Other MATLAB symbols >> prompt . . . continue statement on next line , separate statements and data % start comment which ends at end of line ; (1) suppress output (2) used as a row separator in a matrix : specify range
  • 10. MATLAB Matrices MATLAB treats all variables as matrices. For our purposes a matrix can be thought of as an array, in fact, that is how it is stored. Vectors are special forms of matrices and contain only one row OR one column. Scalars are matrices with only one row AND one column
  • 11. MATLAB Matrices A matrix with only one row AND one column is a scalar. A scalar can be created in MATLAB as follows: » a_value=23 a_value = 23
  • 12. MATLAB Matrices A matrix can be created in MATLAB as follows (note the commas AND semicolons): » matrix = [1 , 2 , 3 ; 4 , 5 ,6 ; 7 , 8 , 9] matrix = 1 2 3 4 5 6 7 8 9
  • 13. MATLAB Matrices A column vector can be extracted from a matrix. As an example we create a matrix below: » matrix=[1,2,3;4,5,6;7,8,9] matrix = 1 2 3 4 5 6 7 8 9 Here we extract column 2 of the matrix and make a column vector: » col_two=matrix( : , 2) col_two = 2 5 8
  • 14. Plotting with MATLAB MATLAB will plot one vector vs. another. The first one will be treated as the abscissa (or x) vector and the second as the ordinate (or y) vector. The vectors have to be the same length. MATLAB will also plot a vector vs. its own index. The index will be treated as the abscissa vector. Given a vector “time” and a vector “dist” we could say: >> plot (time, dist) % plotting versus time >> plot (dist) % plotting versus index
  • 15. Plotting with MATLAB There are commands in MATLAB to &quot;annotate&quot; a plot to put on axis labels, titles, and legends. For example: >> % To put a label on the axes we would use: >> xlabel ('X-axis label') >> ylabel ('Y-axis label') >> % To put a title on the plot, we would use: >> title ('Title of my plot')
  • 16. Some Useful MATLAB commands who List known variables whos List known variables plus their size help >> help sqrt Help on using sqrt lookfor >> lookfor sqrt Search for keyword sqrt in m-files what >> what a: List MATLAB files in a: clear Clear all variables from work space clear x y Clear variables x and y from work space clc Clear the command window
  • 17. Some Useful MATLAB commands what List all m-files in current directory dir List all files in current directory ls Same as dir type test Display test.m in command window delete test Delete test.m cd a: Change directory to a: chdir a: Same as cd pwd Show current directory which test Display directory path to ‘closest’ test.m
  • 18. A Useless, But Interesting, MATLAB command why In case you ever needed a reason
  • 19. MATLAB Relational Operators MATLAB supports six relational operators. Less Than < Less Than or Equal <= Greater Than > Greater Than or Equal >= Equal To == Not Equal To ~=
  • 20. MATLAB Logical Operators MATLAB supports three logical operators. not ~ % highest precedence and & % equal precedence with or or | % equal precedence with and
  • 21. MATLAB Toolboxes Signal & Image Processing Signal Processing Image Processing Communications   Frequency Domain System Identification Higher-Order Spectral Analysis System Identification Wavelet Filter Design Control Design  Control System Fuzzy Logic Robust Control μ-Analysis and Synthesis Model Predictive Control Intro MATLAB Math and Analysis Optimization Requirements Management Interface Statistics Neural Network Symbolic/Extended Math Partial Differential Equations PLS Toolbox Mapping Spline Data Acquisition and Import Data Acquisition Instrument Control Excel Link Portable Graph Object

Editor's Notes

  • #4: Unix is some what like dos or cmd