MATLAB For Dummies, 2nd Edition
Book image
Explore Book Buy On Amazon

In MATLAB, a quiver plot shows the velocity vectors defined by the components u and v at points described by the coordinates defined by x and y. (Read more about the composition of velocity vectors.) When you don’t specify x and y, the plot is created using equally spaced values along the x-axis with a value of y = 1. The following steps help you create a quiver plot.

  1. Type XSource = [1, 1, 1, 1, 1, 1]; and press Enter.

  2. Type YSource = [1, 1, 1, 1, 1, 1]; and press Enter.

    These two vectors define the x/y coordinate pairs used as the starting point for the vectors. In this case, all the vectors have the same origin of 1, 1.

  3. Type USource = [1, 2, 3, 4, 5, 6]; and press Enter.

  4. Type VSource = [6, 5, 4, 3, 2, 1]; and press Enter.

    These two vectors define the positions of the velocity vectors within the x-y plane.

    Notice that the four vectors are the same size. Whenever you create a quiver plot, the vectors must be the same size because they act in pairs to create coordinates.

  5. Type quiver(XSource, YSource, USource, VSource); and press Enter.

    You see a quiver plot.

    image0.jpg

About This Article

This article is from the book:

About the book authors:

Jim Sizemore is professor of physics and engineering at Tyler Junior College. For over 25 years, Sizemore has worked in the semiconductor and software industries as a process engineer, device physicist, and software developer. John Paul Mueller has written more than 100 books and more than 600 articles on topics ranging from functional programming techniques to application development using C++.

This article can be found in the category: