5 views

Uploaded by احمد عقل

- Forward_Analysis_of_5_DOF_Robot_Manipula.pdf
- MATLAB
- delta-math-readiness-standards 20160504 141400 5
- Preview
- study guide summative 1- slope-intercept form 2017-2018
- chapter 3 1 - graphing equations
- MEF_4
- teacher lecture presentation handout - ms
- Number Systems
- Def. of Linier Equation With 1 Variables
- Engineering Mechanics Lecture 2
- Linear Equation Notes
- module 4 unit plan template denny mejia 8th grade 1
- Atserias Sevilla Dmd2018
- lesson plan 1 1
- PHY 242 Lab 3 Draft
- eoc1 Engineering Mechanics
- hs algebra 3
- MatlabBasics Slides
- (3) [Gelfand_Glagoleva_Kirilov] The Method of coordinates..pdf

You are on page 1of 32

MATLAB provides some very powerful features for plotting and labeling curves. These operations can be performed as part of an overall mathematical analysis, or experimental data may be provided to the program for the primary purpose of plotting. Curves obtained from MATLAB plots can be exported to other programs for presentation purposes.

1

MATLAB has the capability to generate plots of many types. This includes linear plots, line plots, logarithmic plots on both scales, logarithmic plots on one scale, stem plots, bar graphs, and threedimensional plots. We will be using these capabilities throughout the text, so the present development is intended as an introduction, with many operations to follow in later chapters.

Vector Lengths

A very important fact that should be emphasized at the outset is that to plot one vector against another, the vectors must have the same number of elements. One can plot either a column vector or a row vector versus either a column vector or a row vector provided they have the same number of values.

If the vectors have different lengths, it is possible to use a portion of the longer one as one of the variables. For example, suppose y has 200 values and x has 120 values. One could define y1 by the following command: >> y1 = y(1:120) The variable y1 now has the same number of points as x and the two could be plotted together.

4

In the two-dimensional plotting commands, the horizontal axis will be referred to as the x-axis and the vertical axis will be referred to as the y-axis. However, the actual variables can be labeled with any quantities. It is only in the plot commands that x and y are used.

Whenever a plot is to be created from an equation, and linear plots for both the dependent and independent variables are desired, the most convenient way to achieve the result is to create a linear array or vector for the values of the independent variable. MATLAB offers a number of different commands that can be used for this purpose. For this explanation, assume that the independent variable is x.

6

>> x = x1:xstep:x2 where x1=beginning point, x2=final point, and xstep=step size. Assuming that the final point coincides with an integer multiple of xstep, the number of points N is

x2 x1 N 1 xstep

7

>> x = linspace(x1, x2, N) where x1=beginning point, x2=final point, and N=number of points. The name linspace represents linear spacing. Again, the number of points N is

x2 x1 N 1 xstep

8

Example 4-1. When air resistance can be ignored, the velocity (in m/s) of an object falling from rest is

v 9.8t

Use MATLAB to plot the velocity over a time interval from 0 to 10 s.

It should be emphasized that this is a simple linear equation with a vertical intercept of 0 so we actually need only two points to plot the curve. However, our purpose is to learn how to use MATLAB for plotting and we will utilize far more points than necessary as a learning process.

10

>> t = 0:0.1:10; Alternately,

>> t = linspace(0,10,101);

11

>> t(1:5)

ans = 0 0.1000 0.4000 0.2000 0.3000

12

>> v = 9.8*t; This command generates 101 values of v corresponding to the 101 values of t. It can be plotted by the command >> plot(t, v) The result is a raw plot but various labels can be added as will be shown on the next slide.

13

14

A horizontal label is provided. >> xlabel(Time, seconds) A vertical label is provided. >> ylabel(Velocity, meters/second) A title is provided. >> title(Figure 4-3. Velocity of falling object of Example 4-1 with grid.) A grid is added. >> grid

15

16

Example 4-2. A force in newtons (N) is given below. Plot the function. 2 f1 (t ) 0.25t

Assume 101-point t vector is in memory. >> f1 = 0.25*t.*t; or >> f1 = 0.25*t.^2: >> plot(t, f1) >> xlabel(Time, seconds) >> ylabel(Force, newtons) >> title(Figure 4-4. Force as a function of time in Example 4-2.) 17 >> grid

18

Example 4-3. A force in newtons (N) is given below. Plot the function.

f 2 (t ) 25 0.25t

Assume 101-point t-vector is in memory. >> f2 = 25+0.25*t.^2; >> plot(t, f2) >> xlabel(Time, seconds) >> ylabel(Force, newtons) >> title(Figure 4-6. Second force as initially obtained in Example 4-3.) >> grid

19

20

Plot is modified by the command

>> axis([0 10 0 50])

21

22

The two functions f1 and f2 of the previous two examples can be plotted on the same graph by the command >> plot(t, f1, t, f2) The command gtext(label) allows a label to placed on a graph using crosshairs. The resulting functions are shown on the next slide.

23

24

Log-Log Plots

y Cx

k

y mx b

' '

'

25

Example 4-5. Plot the 2nd degree function below on a log-log graph.

yx

>> x = logspace(-1, 1, 100); >> y = x.^2; >> loglog(x, y) A grid and additional labeling were provided and the curve is shown on the next slide.

26

27

Command for a bar plot: >> bar (x, y) Command for a stem plot:

>> stem (x, y)

28

Example 4-6. The text contains the sales in thousands of dollars for a small business from 1993 through 2002. Construct a bar graph.

>> year = 1993:2002; >> sales = [ the 10 values in the text]; >> bar(year, sales) The graph with additional labeling is shown on the next slide.

29

30

Example 4-7. Plot the data of the previous example using a stem plot.

Assume that the variables year and sales are still in memory. The command is >> stem (year, sales)

The plot with additional labeling is shown on the next slide.

31

32

- Forward_Analysis_of_5_DOF_Robot_Manipula.pdfUploaded byWai Phyo Maung
- MATLABUploaded byTan Cheehou
- delta-math-readiness-standards 20160504 141400 5Uploaded byapi-329487561
- PreviewUploaded byal-maali
- study guide summative 1- slope-intercept form 2017-2018Uploaded byapi-366582437
- chapter 3 1 - graphing equationsUploaded byapi-263209117
- MEF_4Uploaded bydpsmafia
- teacher lecture presentation handout - msUploaded byapi-449157972
- Number SystemsUploaded bychand7790
- Def. of Linier Equation With 1 VariablesUploaded byYurizkaMeliaSari
- Engineering Mechanics Lecture 2Uploaded byKhalid Yousaf
- Linear Equation NotesUploaded byYau Qi Herng
- module 4 unit plan template denny mejia 8th grade 1Uploaded byapi-366442049
- Atserias Sevilla Dmd2018Uploaded byKevin Mondragon
- lesson plan 1 1Uploaded byapi-399069273
- PHY 242 Lab 3 DraftUploaded bysnomasnayr
- eoc1 Engineering MechanicsUploaded byAnnaIzzat
- hs algebra 3Uploaded byapi-255155256
- MatlabBasics SlidesUploaded byncharala
- (3) [Gelfand_Glagoleva_Kirilov] The Method of coordinates..pdfUploaded byحكيم الفيلسوف الضائع
- Rene Descartes a renowned French Mathematician in the 16th century.docxUploaded byTing Sing Ho
- ,,mn,mnmUploaded byAbdul Ahad
- 2-D AssignmentUploaded byChristian David Will
- General Physics CH 01.pdfUploaded byAnonymous 0rIj5j1i
- AU PRACTICAL lab question.docUploaded byEdwin Vinoth A
- DenavitHartenbergUploaded byMrigKash
- Notes_Four_WF_2.pdfUploaded bydof
- Moment of a Force About a PointUploaded byRuffa Mae Montemayor
- ViewUploaded byhalydia
- 9e 00 Chap Student WorkbookUploaded byathinagkall

- WPS ListUploaded byاحمد عقل
- Proposed Welding Procedure No.gupcO PMS SAQ QC 0001Uploaded byاحمد عقل
- St020de BhtUploaded byاحمد عقل
- Catalogo OuthershieldUploaded byJUAN VASCO
- S390DEUploaded byاحمد عقل
- WPS# P11Uploaded byاحمد عقل
- S290DEUploaded byاحمد عقل
- S590DEUploaded byاحمد عقل
- S690DEUploaded byاحمد عقل
- Lincolin-smaw Outershield ElectrodesUploaded byاحمد عقل
- soldaduraUploaded byWilliam Fernando Reatiga
- Murex Filler Metal Selection GuideUploaded byJUAN VASCO
- WPS (Flare)Uploaded byاحمد عقل
- Catalogos SMAW.pdfUploaded byJUAN VASCO
- W.P.S(super duplex)Uploaded byاحمد عقل
- Electroneumatica_FestoUploaded byRenzo Delgado
- FESTO Hydraulics CourseUploaded bymadmax2222
- Festo Basic PneumaticUploaded byshellafaye
- S600DEUploaded byاحمد عقل
- S200DEUploaded byاحمد عقل
- S290_Info_EUploaded byاحمد عقل
- S401DEUploaded byاحمد عقل
- S000DE_2010Uploaded byاحمد عقل
- S705DEUploaded byاحمد عقل
- S705DEUploaded byاحمد عقل
- S705DEUploaded byاحمد عقل
- S705DEUploaded byاحمد عقل
- S705DEUploaded byاحمد عقل
- S790DEUploaded byاحمد عقل
- Principle of Hydraulic System DesignUploaded bykwameh

- CHAPTER 1 SSMUploaded byjesusita1995
- John Willard Milnor - Topology From the Differentiable ViewpointUploaded byandhrimnir
- systems of linear and quadratic equationsUploaded byapi-242197392
- g8m4 sg system of equations l21-27 2Uploaded byapi-276774049
- Calculus Course 2Uploaded byAbhijit Kar Gupta
- Exercise 1Uploaded bysurya
- Elementary Linear Algebra MathewUploaded byAnup Saravan
- Integral Definido. Exercicios ResolvidosUploaded byDiego Dos Santos Garcia
- OD9 PL MetaheuristicsUploaded bycarolinarvsocn
- MA3110 Tutorial 6 solutionsUploaded byEl Boon
- Runge_Kutta_Collocation_Methods_for_Diff.pdfUploaded byelene shopova
- Lecture 4Uploaded byNaeem Ali Sajad
- Chapter 3 - Circular FunctionsUploaded byRayan
- Sets and Venn Diagrams Igcse Questions AnswersUploaded byAzratee Zawawi
- Collatz Conjecture Proof AttemptUploaded byFernando Sanchez
- Fastest in-Place Stable SortUploaded bypankajsinha
- ProvasResolvidasUploaded bycspmafi
- Data StructureUploaded byVishal Yadav
- Cynthia Lanius FractalsUploaded byPipatico
- [N. Kikuchi, J.T. Oden] Contact Problems in ElastiUploaded byJosmir S. Rodríguez K.
- On Supra Regular Generalized Star b-Closed SetsUploaded byIOSRjournal
- Transactions of the American Mathematical Society Volume 307 issue 2 1988 [doi 10.2307%2F2001190] Oscar Adolfo and Sanchez Valenzuela -- Remarks on Grassmannian Supermanifolds.pdfUploaded bymathfer6268
- MALACCA 2013 M1(Q&A)Uploaded bySTPMmaths
- HCI 2008 Promo w SolutionUploaded byMichael Chee
- Comment on "Gleason-Type TheoremUploaded byYash
- Vector Valued IntegralsUploaded byCarlos Alberto Ajila Loayza
- Grass Mann Algebra BookUploaded bywoodbrent7
- Differential Equations GATE MCQUploaded byJhasper Managyo
- Numerical Simulation of the Couette Flow Using Meshless Weak-strong MethodUploaded byCarlos Dutra Fraga Filho
- A course in Differential Geometry Thierry AubinUploaded byeagle9797