Matematicas

Páginas: 82 (20359 palabras) Publicado: 4 de septiembre de 2012
3 Plotting In Matlab
In this chapter we introduce Matlab technique to draw the graph of functions in a variety of formats. We will begin our work in the plane, plotting the graphs of function, then moving to graphs defined by parametric and polar equations. We’ll then move to 3-space and investigate the nature of curves and surfaces in space.

Table of Contents
3.1 Plotting in the Plane . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Plotting Functions of a Single Variable Two or More Plots Exercises Answers Parametric and Polar Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Parametric Equations Polar Equations Algebraic Curves Exercises Answers Surfaces in Matlab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . Plotting Functions of Two Variables A Bit More Interesting Exercises Answers Parametric Surfaces in Matlab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Exercises Answers Space Curves in Matlab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Handle Graphics Viviani’s Curve Exercises Answers 157 158 168 174 176 181 181 186 191 195 198203 204 210 214 215 219 230 233 239 241 244 251 254

3.2

3.3

3.4

3.5

156 Chapter 3

Plotting In Matlab

Copyright All parts of this Matlab Programming textbook are copyrighted in the name of Department of Mathematics, College of the Redwoods. They are not in the public domain. However, they are being made available free for use in educational institutions. This offer does notextend to any application that is made for profit. Users who have such applications in mind should contact David Arnold at david-arnold@redwoods.edu or Bruce Wagner at bruce-wagner@redwoods.edu. This work (including all text, Portable Document Format files, and any other original works), except where otherwise noted, is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License,and is copyrighted C 2006, Department of Mathematics, College of the Redwoods. To view a copy of this license, visit http://creativecommons.org/licenses/by-ncsa/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.

Section 3.1

Plotting in the Plane 157

3.1 Plotting in the Plane
In the last section we investigated the various arrayoperations available in Matlab. We discovered that most Matlab functions are “array smart,” operating on a vector or matrix with the same ease as they do on single numbers. For example, we can take the square root of a single number. >> sqrt(9) ans = 3 We can just as easily take the square root of each entry of a vector. >> x=[0 1 4 9, 16, 25, 36] x = 0 1 4 9 >> y=sqrt(x) y = 0 1 2 3

16

2536

4

5

6

We also saw that we can easily plot the results. The result of the following command is shown in Figure 3.1 >> plot(x,y,’*’)

Figure 3.1. Plotting y = at discrete values of x.
1



x

Copyrighted material. See: http://msenux.redwoods.edu/Math4Textbook/

158 Chapter 3

Plotting in Matlab

In this section, we will learn how to plot the graphs of a number ofmore complicated functions. We will also investigate a number of formatting options and we will spend some time learning how to annotate our plots (titles, labels, legends, etc.). Finally, in this section we gravitate away from the command line and use script files (introduced in the last section) to produce our plots.

Plotting Functions of a Single Variable
We begin by plotting a number offunctions of a single variable in the Cartesian plane. Let’s start by plotting the graph of a quadratic function. Example 1. Plot the graph of y = x2 − 2x − 3. When you were first introduced to drawing the graphs of functions in college algebra, your were probably taught the following standard technique. First create a table of points that satisfy the equation y = x2 −2x−3, such as the one shown in...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Matematica
  • Matematica
  • Matematicas
  • Las matemáticas
  • Matematica
  • Matematicas
  • Matematica
  • Matematicas

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS