Home

How to Display Velocity Vectors in MATLAB Using quiver()

|
Updated:  
2016-03-26 08:21:29
|
MATLAB For Dummies
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 author:

Jim Sizemore is Professor of Physics and Engineering at Tyler Junior College. For over 25 years he s worked in the semiconductor and software industries as a process engineer, device physicist, and software developer and has been teaching college physics, engineering, and math for the last 13 years.

John Paul Mueller is a freelance author and technical editor. He has writing in his blood, having produced 100 books and more than 600 articles to date. The topics range from networking to home security and from database management to heads-down programming. John has provided technical services to both Data Based Advisor and Coast Compute magazines.