0% found this document useful (0 votes)
145 views4 pages

Quiver or Velocity Plot - MATLAB Quiver

The quiver function in MATLAB creates vector field plots, also known as velocity plots, by displaying arrows at specified points with components given by u and v. Quiver plots allow visualization of vector data on a 2D grid. Arrows can be automatically scaled and customized. x and y inputs can be matrices or vectors, with vectors expanded using meshgrid. Quiver is often used with contour plots to show gradient information.

Uploaded by

Sumon Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
145 views4 pages

Quiver or Velocity Plot - MATLAB Quiver

The quiver function in MATLAB creates vector field plots, also known as velocity plots, by displaying arrows at specified points with components given by u and v. Quiver plots allow visualization of vector data on a 2D grid. Arrows can be automatically scaled and customized. x and y inputs can be matrices or vectors, with vectors expanded using meshgrid. Quiver is often used with contour plots to show gradient information.

Uploaded by

Sumon Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

9/26/2016 QuiverorvelocityplotMATLABquiverMathWorksIndia

quiver
Quiverorvelocityplot

Syntax
quiver(x,y,u,v)
quiver(u,v)
quiver(...,scale)
quiver(...,LineSpec)
quiver(...,LineSpec,'filled')
quiver(...,'PropertyName',PropertyValue,...)
quiver(axes_handle,...)
h=quiver(...)

Description
Aquiverplotdisplaysvelocityvectorsasarrowswithcomponents(u,v)atthepoints(x,y).

Forexample,thefirstvectorisdefinedbycomponentsu(1),v(1)andisdisplayedatthepointx(1),y(1).

quiver(x,y,u,v)plotsvectorsasarrowsatthecoordinatesspecifiedineachcorrespondingpairofelementsinxandy.
Thematricesx,y,u,andvmustallbethesamesizeandcontaincorrespondingpositionandvelocitycomponents.
However,xandycanalsobevectors,asexplainedinthenextsection.Bydefault,thearrowsarescaledtojustnot
overlap,butyoucanscalethemtobelongerorshorterifyouwant.

quiver(u,v)drawsvectorsspecifiedbyuandvatequallyspacedpointsinthexyplane.

quiver(...,scale)automaticallyscalesthearrowstofitwithinthegridandthenstretchesthembythefactorscale.
scale=2doublestheirrelativelength,andscale=0.5halvesthelength.Usescale=0toplotthevelocityvectors
withoutautomaticscaling.YoucanalsotunethelengthofarrowsaftertheyhavebeendrawnbychoosingthePlotEdit
tool,selectingthequiverobject,openingthePropertyEditor,andadjustingtheLengthslider.

quiver(...,LineSpec)specifieslinestyle,markersymbol,andcolorusinganyvalidLineSpec.quiverdrawsthe
markersattheoriginofthevectors.

quiver(...,LineSpec,'filled')fillsmarkersspecifiedbyLineSpec.

quiver(...,'PropertyName',PropertyValue,...)specifiespropertynameandpropertyvaluepairsforthequiver
objectsthefunctioncreates.

quiver(axes_handle,...)plotsintotheaxeswiththehandleaxes_handleinsteadofintothecurrentaxes(gca).

h=quiver(...)returnsthehandletothequiverobject.

ExpandingxandyCoordinates
MATLABexpandsxandyiftheyarenotmatrices.Thisexpansionisequivalenttocallingmeshgridtogenerate
matricesfromvectors:

https://in.mathworks.com/help/matlab/ref/quiver.html 1/4
9/26/2016 QuiverorvelocityplotMATLABquiverMathWorksIndia

[x,y]=meshgrid(x,y);
quiver(x,y,u,v)

Inthiscase,thefollowingmustbetrue:

length(x)=nandlength(y)=m,where[m,n]=size(u)=size(v).

Thevectorxcorrespondstothecolumnsofuandv,andvectorycorrespondstotherowsofuandv.

Examples collapseall

PlotVectorVelocities

Usequivertodisplayanarrowateachdatapointinxandysuchthat
thearrowdirectionandlengthrepresentthecorrespondingvaluesinu OpenScript
andv.

[x,y]=meshgrid(0:0.2:2,0:0.2:2);
u=cos(x).*y;
v=sin(x).*y;

figure
quiver(x,y,u,v)

ShowGradientwithQuiverPlot

Plotthegradientofthefunction .
OpenScript

https://in.mathworks.com/help/matlab/ref/quiver.html 2/4
9/26/2016 QuiverorvelocityplotMATLABquiverMathWorksIndia

[X,Y]=meshgrid(2:.2:2);
Z=X.*exp(X.^2Y.^2);
[DX,DY]=gradient(Z,.2,.2);

figure
contour(X,Y,Z)
holdon
quiver(X,Y,DX,DY)
holdoff

MoreAbout
CombineContourPlotandQuiverPlot

SeeAlso

Functions
contour|LineSpec|plot|quiver3

Properties
QuiverSeriesProperties

IntroducedbeforeR2006a

https://in.mathworks.com/help/matlab/ref/quiver.html 3/4
9/26/2016 QuiverorvelocityplotMATLABquiverMathWorksIndia

https://in.mathworks.com/help/matlab/ref/quiver.html 4/4

You might also like