SlideShare une entreprise Scribd logo
1  sur  6
Télécharger pour lire hors ligne
http://www.tutorialspoint.com/matlab/matlab_plotting .htm Copyright © tutorialspoint.com
MATLAB - PLOTTING
To plot the graphof a function, youneed to take the following steps:
1. Define x, by specifying the range of values for the variable x, for whichthe functionis to be plotted
2. Define the function, y = f(x)
3. Callthe plot command, as plot(x, y)
Following example would demonstrate the concept. Let us plot the simple functiony = x for the range of values
for x from0 to 100, withanincrement of 5.
Create a script file and type the following code:
x = [0:5:100];
y = x;
plot(x, y)
Whenyourunthe file, MATLAB displays the following plot:
Let us take one more example to plot the functiony = x2. Inthis example, we willdraw two graphs withthe same
function, but insecond time, we willreduce the value of increment. Please note that as we decrease the
increment, the graphbecomes smoother.
Create a script file and type the following code:
x = [1 2 3 4 5 6 7 8 9 10];
x = [-100:20:100];
y = x.^2;
plot(x, y)
Whenyourunthe file, MATLAB displays the following plot:
Change the code file a little, reduce the increment to 5:
x = [-100:5:100];
y = x.^2;
plot(x, y)
MATLAB draws a smoother graph:
Adding Title, Labels, Grid Lines and Scaling on the Graph
MATLAB allows youto add title, labels along the x-axis and y-axis, grid lines and also to adjust the axes to
spruce up the graph.
The xlabel and ylabel commands generate labels along x-axis and y-axis.
The title command allows youto put a title onthe graph.
The grid on command allows youto put the grid lines onthe graph.
The axis equal command allows generating the plot withthe same scale factors and the spaces onboth
axes.
The axis square command generates a square plot.
Example
Create a script file and type the following code:
x = [0:0.01:10];
y = sin(x);
plot(x, y), xlabel('x'), ylabel('Sin(x)'), title('Sin(x) Graph'),
grid on, axis equal
MATLAB generates the following graph:
Drawing Multiple Functions on the Same Graph
Youcandraw multiple graphs onthe same plot. The following example demonstrates the concept:
Example
Create a script file and type the following code:
x = [0 : 0.01: 10];
y = sin(x);
g = cos(x);
plot(x, y, x, g, '.-'), legend('Sin(x)', 'Cos(x)')
MATLAB generates the following graph:
Setting Colors on Graph
MATLAB provides eight basic color options for drawing graphs. The following table shows the colors and their
codes:
Color Code
White w
Black k
Blue b
Red r
Cyan c
Green g
Magenta m
Yellow y
Example
Let us draw the graphof two polynomials
1. f(x) = 3x4 + 2x3+ 7x2 + 2x + 9 and
2. g(x) = 5x3 + 9x + 2
Create a script file and type the following code:
x = [-10 : 0.01: 10];
y = 3*x.^4 + 2 * x.^3 + 7 * x.^2 + 2 * x + 9;
g = 5 * x.^3 + 9 * x + 2;
plot(x, y, 'r', x, g, 'g')
Whenyourunthe file, MATLAB generates the following graph:
Setting Axis Scales
The axis command allows youto set the axis scales. Youcanprovide minimumand maximumvalues for x and y
axes using the axis command inthe following way:
axis ( [xmin xmax ymin ymax] )
The following example shows this:
Example
Create a script file and type the following code:
x = [0 : 0.01: 10];
y = exp(-x).* sin(2*x + 3);
plot(x, y), axis([0 10 -1 1])
Whenyourunthe file, MATLAB generates the following graph:
Generating Sub-Plots
Whenyoucreate anarray of plots inthe same figure, eachof these plots is called a subplot. The subplot
command is for creating subplots.
Syntax for the command is:
subplot(m, n, p)
where, m and n are the number of rows and columns of the plot array and p specifies where to put a particular
plot.
Eachplot created withthe subplot command canhave its owncharacteristics. Following example demonstrates
the concept:
Example
Let us generate two plots:
y = e−1.5xsin(10x)
y = e−2xsin(10x)
Create a script file and type the following code:
x = [0:0.01:5];
y = exp(-1.5*x).*sin(10*x);
subplot(1,2,1)
plot(x,y), xlabel('x'),ylabel('exp(–1.5x)*sin(10x)'),axis([0 5 -1 1])
y = exp(-2*x).*sin(10*x);
subplot(1,2,2)
plot(x,y),xlabel('x'),ylabel('exp(–2x)*sin(10x)'),axis([0 5 -1 1])
Whenyourunthe file, MATLAB generates the following graph:

Contenu connexe

Tendances

Lesson 4: Lines and Planes (slides + notes)
Lesson 4: Lines and Planes (slides + notes)Lesson 4: Lines and Planes (slides + notes)
Lesson 4: Lines and Planes (slides + notes)
Matthew Leingang
 
03 truncation errors
03 truncation errors03 truncation errors
03 truncation errors
maheej
 

Tendances (20)

Lesson 4: Lines and Planes (slides + notes)
Lesson 4: Lines and Planes (slides + notes)Lesson 4: Lines and Planes (slides + notes)
Lesson 4: Lines and Planes (slides + notes)
 
Double integration
Double integrationDouble integration
Double integration
 
Basic concepts of curve fittings
Basic concepts of curve fittingsBasic concepts of curve fittings
Basic concepts of curve fittings
 
Graph Plots in Matlab
Graph Plots in MatlabGraph Plots in Matlab
Graph Plots in Matlab
 
Lecture 04 newton-raphson, secant method etc
Lecture 04 newton-raphson, secant method etcLecture 04 newton-raphson, secant method etc
Lecture 04 newton-raphson, secant method etc
 
目で見る過学習と正則化
目で見る過学習と正則化目で見る過学習と正則化
目で見る過学習と正則化
 
Tree, function and graph
Tree, function and graphTree, function and graph
Tree, function and graph
 
03 truncation errors
03 truncation errors03 truncation errors
03 truncation errors
 
MATLAB ODE
MATLAB ODEMATLAB ODE
MATLAB ODE
 
1523 double integrals
1523 double integrals1523 double integrals
1523 double integrals
 
All pair shortest path
All pair shortest pathAll pair shortest path
All pair shortest path
 
Numerical integration;Gaussian integration one point, two point and three poi...
Numerical integration;Gaussian integration one point, two point and three poi...Numerical integration;Gaussian integration one point, two point and three poi...
Numerical integration;Gaussian integration one point, two point and three poi...
 
Bisection
BisectionBisection
Bisection
 
Jacobi method for MATLAB
Jacobi method for MATLAB Jacobi method for MATLAB
Jacobi method for MATLAB
 
Lesson 25: Evaluating Definite Integrals (slides)
Lesson 25: Evaluating Definite Integrals (slides)Lesson 25: Evaluating Definite Integrals (slides)
Lesson 25: Evaluating Definite Integrals (slides)
 
コミュニティ分類アルゴリズムの高速化とソーシャルグラフへの応用
コミュニティ分類アルゴリズムの高速化とソーシャルグラフへの応用コミュニティ分類アルゴリズムの高速化とソーシャルグラフへの応用
コミュニティ分類アルゴリズムの高速化とソーシャルグラフへの応用
 
Introduction to-matlab
Introduction to-matlabIntroduction to-matlab
Introduction to-matlab
 
Numerical Methods - Power Method for Eigen values
Numerical Methods - Power Method for Eigen valuesNumerical Methods - Power Method for Eigen values
Numerical Methods - Power Method for Eigen values
 
[PRML] パターン認識と機械学習(第3章:線形回帰モデル)
[PRML] パターン認識と機械学習(第3章:線形回帰モデル)[PRML] パターン認識と機械学習(第3章:線形回帰モデル)
[PRML] パターン認識と機械学習(第3章:線形回帰モデル)
 
Numerical integration
Numerical integrationNumerical integration
Numerical integration
 

En vedette (7)

matlab functions
 matlab functions  matlab functions
matlab functions
 
Matlab tutorial
Matlab tutorialMatlab tutorial
Matlab tutorial
 
graphs plotting in MATLAB
graphs plotting in MATLABgraphs plotting in MATLAB
graphs plotting in MATLAB
 
Matlab
MatlabMatlab
Matlab
 
Mit6 094 iap10_lec01
Mit6 094 iap10_lec01Mit6 094 iap10_lec01
Mit6 094 iap10_lec01
 
2D Plot Matlab
2D Plot Matlab2D Plot Matlab
2D Plot Matlab
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
 

Similaire à Matlab plotting

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
gilpinleeanna
 
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
agnesdcarey33086
 
Matlab 1
Matlab 1Matlab 1
Matlab 1
asguna
 
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
anhlodge
 
CIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & CourseworkCIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & Coursework
TUOS-Sam
 

Similaire à Matlab plotting (20)

Lesson 3
Lesson 3Lesson 3
Lesson 3
 
Matlab graphics
Matlab graphicsMatlab graphics
Matlab graphics
 
Programming with matlab session 6
Programming with matlab session 6Programming with matlab session 6
Programming with matlab session 6
 
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
 
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
 
Matlab integration
Matlab integrationMatlab integration
Matlab integration
 
Matlab-free course by Mohd Esa
Matlab-free course by Mohd EsaMatlab-free course by Mohd Esa
Matlab-free course by Mohd Esa
 
Mat lab
Mat labMat lab
Mat lab
 
Tutorial 2
Tutorial     2Tutorial     2
Tutorial 2
 
COMPANION TO MATRICES SESSION III.pptx
COMPANION TO MATRICES SESSION III.pptxCOMPANION TO MATRICES SESSION III.pptx
COMPANION TO MATRICES SESSION III.pptx
 
Matlab algebra
Matlab algebraMatlab algebra
Matlab algebra
 
Matlab 1
Matlab 1Matlab 1
Matlab 1
 
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
 
Introduction to r
Introduction to rIntroduction to r
Introduction to r
 
Lecture 2 f17
Lecture 2 f17Lecture 2 f17
Lecture 2 f17
 
Lec2
Lec2Lec2
Lec2
 
CIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & CourseworkCIV1900 Matlab - Plotting & Coursework
CIV1900 Matlab - Plotting & Coursework
 
presentation.pptx
presentation.pptxpresentation.pptx
presentation.pptx
 
Computer Graphics in Java and Scala - Part 1
Computer Graphics in Java and Scala - Part 1Computer Graphics in Java and Scala - Part 1
Computer Graphics in Java and Scala - Part 1
 
Matlab graphics
Matlab graphicsMatlab graphics
Matlab graphics
 

Plus de 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 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
 
Matlab data import
Matlab data importMatlab data import
Matlab data import
 

Dernier

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
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
heathfieldcps1
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Dernier (20)

psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
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
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 

Matlab plotting

  • 1. http://www.tutorialspoint.com/matlab/matlab_plotting .htm Copyright © tutorialspoint.com MATLAB - PLOTTING To plot the graphof a function, youneed to take the following steps: 1. Define x, by specifying the range of values for the variable x, for whichthe functionis to be plotted 2. Define the function, y = f(x) 3. Callthe plot command, as plot(x, y) Following example would demonstrate the concept. Let us plot the simple functiony = x for the range of values for x from0 to 100, withanincrement of 5. Create a script file and type the following code: x = [0:5:100]; y = x; plot(x, y) Whenyourunthe file, MATLAB displays the following plot: Let us take one more example to plot the functiony = x2. Inthis example, we willdraw two graphs withthe same function, but insecond time, we willreduce the value of increment. Please note that as we decrease the increment, the graphbecomes smoother. Create a script file and type the following code: x = [1 2 3 4 5 6 7 8 9 10]; x = [-100:20:100]; y = x.^2; plot(x, y) Whenyourunthe file, MATLAB displays the following plot:
  • 2. Change the code file a little, reduce the increment to 5: x = [-100:5:100]; y = x.^2; plot(x, y) MATLAB draws a smoother graph: Adding Title, Labels, Grid Lines and Scaling on the Graph MATLAB allows youto add title, labels along the x-axis and y-axis, grid lines and also to adjust the axes to spruce up the graph. The xlabel and ylabel commands generate labels along x-axis and y-axis. The title command allows youto put a title onthe graph. The grid on command allows youto put the grid lines onthe graph. The axis equal command allows generating the plot withthe same scale factors and the spaces onboth axes.
  • 3. The axis square command generates a square plot. Example Create a script file and type the following code: x = [0:0.01:10]; y = sin(x); plot(x, y), xlabel('x'), ylabel('Sin(x)'), title('Sin(x) Graph'), grid on, axis equal MATLAB generates the following graph: Drawing Multiple Functions on the Same Graph Youcandraw multiple graphs onthe same plot. The following example demonstrates the concept: Example Create a script file and type the following code: x = [0 : 0.01: 10]; y = sin(x); g = cos(x); plot(x, y, x, g, '.-'), legend('Sin(x)', 'Cos(x)') MATLAB generates the following graph:
  • 4. Setting Colors on Graph MATLAB provides eight basic color options for drawing graphs. The following table shows the colors and their codes: Color Code White w Black k Blue b Red r Cyan c Green g Magenta m Yellow y Example Let us draw the graphof two polynomials 1. f(x) = 3x4 + 2x3+ 7x2 + 2x + 9 and 2. g(x) = 5x3 + 9x + 2 Create a script file and type the following code: x = [-10 : 0.01: 10]; y = 3*x.^4 + 2 * x.^3 + 7 * x.^2 + 2 * x + 9; g = 5 * x.^3 + 9 * x + 2; plot(x, y, 'r', x, g, 'g') Whenyourunthe file, MATLAB generates the following graph:
  • 5. Setting Axis Scales The axis command allows youto set the axis scales. Youcanprovide minimumand maximumvalues for x and y axes using the axis command inthe following way: axis ( [xmin xmax ymin ymax] ) The following example shows this: Example Create a script file and type the following code: x = [0 : 0.01: 10]; y = exp(-x).* sin(2*x + 3); plot(x, y), axis([0 10 -1 1]) Whenyourunthe file, MATLAB generates the following graph:
  • 6. Generating Sub-Plots Whenyoucreate anarray of plots inthe same figure, eachof these plots is called a subplot. The subplot command is for creating subplots. Syntax for the command is: subplot(m, n, p) where, m and n are the number of rows and columns of the plot array and p specifies where to put a particular plot. Eachplot created withthe subplot command canhave its owncharacteristics. Following example demonstrates the concept: Example Let us generate two plots: y = e−1.5xsin(10x) y = e−2xsin(10x) Create a script file and type the following code: x = [0:0.01:5]; y = exp(-1.5*x).*sin(10*x); subplot(1,2,1) plot(x,y), xlabel('x'),ylabel('exp(–1.5x)*sin(10x)'),axis([0 5 -1 1]) y = exp(-2*x).*sin(10*x); subplot(1,2,2) plot(x,y),xlabel('x'),ylabel('exp(–2x)*sin(10x)'),axis([0 5 -1 1]) Whenyourunthe file, MATLAB generates the following graph: