SlideShare a Scribd company logo
1 of 4
Download to read offline
http://www.tutorialspoint.com/matlab/matlab_g raphics.htm Copyright © tutorialspoint.com
MATLAB - GRAPHICS
This chapter willcontinue exploring the plotting and graphics capabilities of MATLAB. We willdiscuss:
Drawing bar charts
Drawing contours
Three dimensionalplots
Drawing Bar Charts
The bar command draws a two dimensionalbar chart. Let us take up anexample to demonstrate the idea.
Example
Let us have animaginary classroomwith10 students. We know the percent of marks obtained by these students
are 75, 58, 90, 87, 50, 85, 92, 75, 60 and 95. We willdraw the bar chart for this data.
Create a script file and type the following code:
x = [1:10];
y = [75, 58, 90, 87, 50, 85, 92, 75, 60, 95];
bar(x,y), xlabel('Student'),ylabel('Score'),
title('First Sem:')
print -deps graph.eps
Whenyourunthe file, MATLAB displays the following bar chart:
Drawing Contours
A contour line of a functionof two variables is a curve along whichthe functionhas a constant value. Contour lines
are used for creating contour maps by joining points of equalelevationabove a givenlevel, suchas meansea
level.
MATLAB provides a contour functionfor drawing contour maps.
Example
Let us generate a contour map that shows the contour lines for a givenfunctiong = f(x, y). This functionhas two
variables. So, we willhave to generate two independent variables, i.e., two data sets x and y. This is done by
calling the meshgrid command.
The meshgrid command is used for generating a matrix of elements that give the range over x and y along with
the specificationof increment ineachcase.
Let us plot our functiong = f(x, y), where −5 ≤ x ≤ 5, −3 ≤ y ≤ 3. Let us take anincrement of 0.1 for boththe
values. The variables are set as:
[x,y] = meshgrid(–5:0.1:5, –3:0.1:3);
Lastly, we need to assignthe function. Let our functionbe: x2 + y2
Create a script file and type the following code:
[x,y] = meshgrid(-5:0.1:5,-3:0.1:3); %independent variables
g = x.^2 + y.^2; % our function
contour(x,y,g) % call the contour function
print -deps graph.eps
Whenyourunthe file, MATLAB displays the following contour map:
Let us modify the code a little to spruce up the map:
[x,y] = meshgrid(-5:0.1:5,-3:0.1:3); %independent variables
g = x.^2 + y.^2; % our function
[C, h] = contour(x,y,g); % call the contour function
set(h,'ShowText','on','TextStep',get(h,'LevelStep')*2)
print -deps graph.eps
Whenyourunthe file, MATLAB displays the following contour map:
Three Dimensional Plots
Three-dimensionalplots basically display a surface defined by a functionintwo variables, g = f (x,y).
As before, to define g, we first create a set of (x,y) points over the domainof the functionusing the meshgrid
command. Next, we assignthe functionitself. Finally, we use the surf command to create a surface plot.
The following example demonstrates the concept:
Example
Let us create a 3D surface map for the functiong = xe-(x2
+ y2
)
Create a script file and type the following code:
[x,y] = meshgrid(-2:.2:2);
g = x .* exp(-x.^2 - y.^2);
surf(x, y, g)
print -deps graph.eps
Whenyourunthe file, MATLAB displays the following 3-D map:
Youcanalso use the mesh command to generate a three-dimensionalsurface. However, the surf command
displays boththe connecting lines and the faces of the surface incolor, whereas, the mesh command creates a
wireframe surface withcolored lines connecting the defining points.

More Related Content

What's hot

5 5pt Slope
5 5pt Slope5 5pt Slope
5 5pt Slopetaco40
 
maXbox starter65 machinelearning3
maXbox starter65 machinelearning3maXbox starter65 machinelearning3
maXbox starter65 machinelearning3Max Kleiner
 
Streaming Python on Hadoop
Streaming Python on HadoopStreaming Python on Hadoop
Streaming Python on HadoopVivian S. Zhang
 
computer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcodecomputer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcodeBhavya Chawla
 
maXbox starter68 machine learning VI
maXbox starter68 machine learning VImaXbox starter68 machine learning VI
maXbox starter68 machine learning VIMax Kleiner
 
Using r in introduction statistics
Using r in introduction statisticsUsing r in introduction statistics
Using r in introduction statisticsYayan Mulyana
 
Parent Functions
Parent FunctionsParent Functions
Parent FunctionsVLB10525
 
React + Redux + d3.js
React + Redux + d3.jsReact + Redux + d3.js
React + Redux + d3.jsTeemu Kurppa
 
Project2
Project2Project2
Project2?? ?
 
ECE 565 Project1
ECE 565 Project1ECE 565 Project1
ECE 565 Project1?? ?
 
Machine Learning Basics for Web Application Developers
Machine Learning Basics for Web Application DevelopersMachine Learning Basics for Web Application Developers
Machine Learning Basics for Web Application DevelopersEtsuji Nakai
 
Dm week01 linreg.handout
Dm week01 linreg.handoutDm week01 linreg.handout
Dm week01 linreg.handoutokeee
 
Graphing Inequalities Example
Graphing Inequalities ExampleGraphing Inequalities Example
Graphing Inequalities Examplesbishoptcl
 

What's hot (20)

5 5pt Slope
5 5pt Slope5 5pt Slope
5 5pt Slope
 
maXbox starter65 machinelearning3
maXbox starter65 machinelearning3maXbox starter65 machinelearning3
maXbox starter65 machinelearning3
 
Streaming Python on Hadoop
Streaming Python on HadoopStreaming Python on Hadoop
Streaming Python on Hadoop
 
K10765 Matlab 3D Mesh Plots
K10765 Matlab 3D Mesh PlotsK10765 Matlab 3D Mesh Plots
K10765 Matlab 3D Mesh Plots
 
computer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcodecomputer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcode
 
EE201_Assignment4
EE201_Assignment4EE201_Assignment4
EE201_Assignment4
 
Matlab plotting
Matlab plottingMatlab plotting
Matlab plotting
 
Garvey
GarveyGarvey
Garvey
 
Matlab tutorial 1
Matlab tutorial 1Matlab tutorial 1
Matlab tutorial 1
 
maXbox starter68 machine learning VI
maXbox starter68 machine learning VImaXbox starter68 machine learning VI
maXbox starter68 machine learning VI
 
Lesson 3.4
Lesson 3.4Lesson 3.4
Lesson 3.4
 
Using r in introduction statistics
Using r in introduction statisticsUsing r in introduction statistics
Using r in introduction statistics
 
Parent Functions
Parent FunctionsParent Functions
Parent Functions
 
Parent Function Project
Parent Function ProjectParent Function Project
Parent Function Project
 
React + Redux + d3.js
React + Redux + d3.jsReact + Redux + d3.js
React + Redux + d3.js
 
Project2
Project2Project2
Project2
 
ECE 565 Project1
ECE 565 Project1ECE 565 Project1
ECE 565 Project1
 
Machine Learning Basics for Web Application Developers
Machine Learning Basics for Web Application DevelopersMachine Learning Basics for Web Application Developers
Machine Learning Basics for Web Application Developers
 
Dm week01 linreg.handout
Dm week01 linreg.handoutDm week01 linreg.handout
Dm week01 linreg.handout
 
Graphing Inequalities Example
Graphing Inequalities ExampleGraphing Inequalities Example
Graphing Inequalities Example
 

Viewers also liked

Viewers also liked (12)

Sin título 1
Sin título 1Sin título 1
Sin título 1
 
Blog review
Blog reviewBlog review
Blog review
 
Metodocientifico
MetodocientificoMetodocientifico
Metodocientifico
 
Fenomenos naturales
Fenomenos naturalesFenomenos naturales
Fenomenos naturales
 
Jesse's 1st Photo Story
Jesse's 1st Photo StoryJesse's 1st Photo Story
Jesse's 1st Photo Story
 
Fenomenos naturales
Fenomenos naturalesFenomenos naturales
Fenomenos naturales
 
Crentes periféricos
Crentes periféricosCrentes periféricos
Crentes periféricos
 
Internet of Ideas: Paper Electronics
Internet of Ideas: Paper ElectronicsInternet of Ideas: Paper Electronics
Internet of Ideas: Paper Electronics
 
3 los modelos de la comunicación
3  los modelos de la comunicación3  los modelos de la comunicación
3 los modelos de la comunicación
 
Formación tecnopedagógica en ambientes virtuales.
Formación  tecnopedagógica en ambientes virtuales.Formación  tecnopedagógica en ambientes virtuales.
Formación tecnopedagógica en ambientes virtuales.
 
A Guide to Summer Clothing
A Guide to Summer ClothingA Guide to Summer Clothing
A Guide to Summer Clothing
 
Business alignment of Procurement
Business alignment of ProcurementBusiness alignment of Procurement
Business alignment of Procurement
 

Similar to Matlab graphics

Matlab-free course by Mohd Esa
Matlab-free course by Mohd EsaMatlab-free course by Mohd Esa
Matlab-free course by Mohd EsaMohd Esa
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical ComputingNaveed Rehman
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxagnesdcarey33086
 
More instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docxMore instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docxgilpinleeanna
 
CIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & CourseworkCIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & CourseworkTUOS-Sam
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxanhlodge
 
Introduction to matlab lecture 4 of 4
Introduction to matlab lecture 4 of 4Introduction to matlab lecture 4 of 4
Introduction to matlab lecture 4 of 4Randa Elanwar
 
COMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptxCOMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptximman gwu
 
INTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxINTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxDevaraj Chilakala
 
Fundamentals of Image Processing & Computer Vision with MATLAB
Fundamentals of Image Processing & Computer Vision with MATLABFundamentals of Image Processing & Computer Vision with MATLAB
Fundamentals of Image Processing & Computer Vision with MATLABAli Ghanbarzadeh
 
MATLAB-Introd.ppt
MATLAB-Introd.pptMATLAB-Introd.ppt
MATLAB-Introd.pptkebeAman
 
Matlab 1
Matlab 1Matlab 1
Matlab 1asguna
 
Chapter 1: Linear Regression
Chapter 1: Linear RegressionChapter 1: Linear Regression
Chapter 1: Linear RegressionAkmelSyed
 

Similar to Matlab graphics (20)

Matlab plotting
Matlab plottingMatlab plotting
Matlab plotting
 
Matlab-free course by Mohd Esa
Matlab-free course by Mohd EsaMatlab-free course by Mohd Esa
Matlab-free course by Mohd Esa
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical Computing
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
 
More instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docxMore instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docx
 
Lesson 3
Lesson 3Lesson 3
Lesson 3
 
CIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & CourseworkCIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & Coursework
 
Mat lab
Mat labMat lab
Mat lab
 
presentation.pptx
presentation.pptxpresentation.pptx
presentation.pptx
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
 
bobok
bobokbobok
bobok
 
Introduction to matlab lecture 4 of 4
Introduction to matlab lecture 4 of 4Introduction to matlab lecture 4 of 4
Introduction to matlab lecture 4 of 4
 
Matlab1
Matlab1Matlab1
Matlab1
 
COMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptxCOMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptx
 
INTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptxINTRODUCTION TO MATLAB presentation.pptx
INTRODUCTION TO MATLAB presentation.pptx
 
Fundamentals of Image Processing & Computer Vision with MATLAB
Fundamentals of Image Processing & Computer Vision with MATLABFundamentals of Image Processing & Computer Vision with MATLAB
Fundamentals of Image Processing & Computer Vision with MATLAB
 
MATLAB-Introd.ppt
MATLAB-Introd.pptMATLAB-Introd.ppt
MATLAB-Introd.ppt
 
Matlab 1
Matlab 1Matlab 1
Matlab 1
 
Chapter 1: Linear Regression
Chapter 1: Linear RegressionChapter 1: Linear Regression
Chapter 1: Linear Regression
 
Tutorial 2
Tutorial     2Tutorial     2
Tutorial 2
 

More from pramodkumar1804 (20)

Matlab syntax
Matlab syntaxMatlab syntax
Matlab syntax
 
Matlab strings
Matlab stringsMatlab strings
Matlab strings
 
Matlab simulink
Matlab simulinkMatlab simulink
Matlab simulink
 
Matlab polynomials
Matlab polynomialsMatlab polynomials
Matlab polynomials
 
Matlab overview 3
Matlab overview 3Matlab overview 3
Matlab overview 3
 
Matlab overview 2
Matlab overview 2Matlab overview 2
Matlab overview 2
 
Matlab overview
Matlab overviewMatlab overview
Matlab overview
 
Matlab operators
Matlab operatorsMatlab operators
Matlab operators
 
Matlab variables
Matlab variablesMatlab variables
Matlab variables
 
Matlab numbers
Matlab numbersMatlab numbers
Matlab numbers
 
Matlab matrics
Matlab matricsMatlab matrics
Matlab matrics
 
Matlab m files
Matlab m filesMatlab m files
Matlab m files
 
Matlab loops 2
Matlab loops 2Matlab loops 2
Matlab loops 2
 
Matlab loops
Matlab loopsMatlab loops
Matlab loops
 
Matlab integration
Matlab integrationMatlab integration
Matlab integration
 
Matlab gnu octave
Matlab gnu octaveMatlab gnu octave
Matlab gnu octave
 
Matlab operators
Matlab operatorsMatlab operators
Matlab operators
 
Matlab functions
Matlab functionsMatlab functions
Matlab functions
 
Matlab differential
Matlab differentialMatlab differential
Matlab differential
 
Matlab decisions
Matlab decisionsMatlab decisions
Matlab decisions
 

Recently uploaded

Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 

Recently uploaded (20)

Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 

Matlab graphics

  • 1. http://www.tutorialspoint.com/matlab/matlab_g raphics.htm Copyright © tutorialspoint.com MATLAB - GRAPHICS This chapter willcontinue exploring the plotting and graphics capabilities of MATLAB. We willdiscuss: Drawing bar charts Drawing contours Three dimensionalplots Drawing Bar Charts The bar command draws a two dimensionalbar chart. Let us take up anexample to demonstrate the idea. Example Let us have animaginary classroomwith10 students. We know the percent of marks obtained by these students are 75, 58, 90, 87, 50, 85, 92, 75, 60 and 95. We willdraw the bar chart for this data. Create a script file and type the following code: x = [1:10]; y = [75, 58, 90, 87, 50, 85, 92, 75, 60, 95]; bar(x,y), xlabel('Student'),ylabel('Score'), title('First Sem:') print -deps graph.eps Whenyourunthe file, MATLAB displays the following bar chart: Drawing Contours A contour line of a functionof two variables is a curve along whichthe functionhas a constant value. Contour lines are used for creating contour maps by joining points of equalelevationabove a givenlevel, suchas meansea level. MATLAB provides a contour functionfor drawing contour maps. Example Let us generate a contour map that shows the contour lines for a givenfunctiong = f(x, y). This functionhas two variables. So, we willhave to generate two independent variables, i.e., two data sets x and y. This is done by
  • 2. calling the meshgrid command. The meshgrid command is used for generating a matrix of elements that give the range over x and y along with the specificationof increment ineachcase. Let us plot our functiong = f(x, y), where −5 ≤ x ≤ 5, −3 ≤ y ≤ 3. Let us take anincrement of 0.1 for boththe values. The variables are set as: [x,y] = meshgrid(–5:0.1:5, –3:0.1:3); Lastly, we need to assignthe function. Let our functionbe: x2 + y2 Create a script file and type the following code: [x,y] = meshgrid(-5:0.1:5,-3:0.1:3); %independent variables g = x.^2 + y.^2; % our function contour(x,y,g) % call the contour function print -deps graph.eps Whenyourunthe file, MATLAB displays the following contour map: Let us modify the code a little to spruce up the map: [x,y] = meshgrid(-5:0.1:5,-3:0.1:3); %independent variables g = x.^2 + y.^2; % our function [C, h] = contour(x,y,g); % call the contour function set(h,'ShowText','on','TextStep',get(h,'LevelStep')*2) print -deps graph.eps Whenyourunthe file, MATLAB displays the following contour map:
  • 3. Three Dimensional Plots Three-dimensionalplots basically display a surface defined by a functionintwo variables, g = f (x,y). As before, to define g, we first create a set of (x,y) points over the domainof the functionusing the meshgrid command. Next, we assignthe functionitself. Finally, we use the surf command to create a surface plot. The following example demonstrates the concept: Example Let us create a 3D surface map for the functiong = xe-(x2 + y2 ) Create a script file and type the following code: [x,y] = meshgrid(-2:.2:2); g = x .* exp(-x.^2 - y.^2); surf(x, y, g) print -deps graph.eps Whenyourunthe file, MATLAB displays the following 3-D map:
  • 4. Youcanalso use the mesh command to generate a three-dimensionalsurface. However, the surf command displays boththe connecting lines and the faces of the surface incolor, whereas, the mesh command creates a wireframe surface withcolored lines connecting the defining points.