MATLAB For Dummies
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:

John Paul Mueller is an author and technical editor with experience in application development, database management, machine learning, and deep learning. He has written hundreds of books and articles helping everyday people learn everything from networking to database management.

John Mueller has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services (AWS). Luca Massaron, a Google Developer Expert (GDE),??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques.

This article can be found in the category: