File Exchange

image thumbnail

quiver_tri(x,y,u,v,​varargin)

version 1.0.0.0 (2.58 KB) by Alessandro Masullo
Quiver plot with filled triangles head

11 Downloads

Updated 25 Apr 2016

View License

Plot velocity vector fields with filled arrow head.
This function is not optimized for speed. Do not use in loops
%QUIVER_TRI Quiver plot with filled triangles
% QUIVER_TRI(x,y,u,v) plots velocity vectors with filled triangle arrows.
% Contrary to QUIVER, QUIVER_TRI does not scale vectors before plotting
% them. Vectors will be plotted with the same spacing and magnitude as
% they are provided. Default head arrow size is 20% of the median
% magnitude and default head angle is 22.5 degrees.
%
% QUIVER_TRI(x,y,u,v,headsize) plots velocity vectors specifying the
% headsize (same units as u and v).
%
% QUIVER_TRI(x,y,u,v,headsize,headangle) plots velocity vectors
% specifying the head size (same units as u and v) and the head angle
% amplitude (in degrees).
%
% QUIVER_TRI(x,y,u,v,headsize,headangle,width) same as before, plus
% setting of the quiver body width
%
% QUIVER_TRI(x,y,u,v,headsize,headangle,width,col) same as before, plus
% setting of the color
%
% See also QUIVER.

Cite As

Alessandro Masullo (2020). quiver_tri(x,y,u,v,varargin) (https://www.mathworks.com/matlabcentral/fileexchange/53596-quiver_tri-x-y-u-v-varargin), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (11)

Alessandro

@Lars Chresten Lund-Hansen
You can remove the NaN elements from your array before calling the function and an empty spot should be left where a NaN is

I guess it doesn't work with NaN values?

Alessandro

@khalid Elserfy
the only thing that I can think of is that you're using the function with the wrong number of arguments. How are you calling the function?

khalid Elserfy

hi
i tried using the function
quiver_tri(X2,flip(Y2),U,V,7)

but i got that error message :
Undefined function or variable 'triA'.
Error in quiver_tri (line 66)
triA = triA/180*pi;

do you know whats that issue?

Emmanuel Emmanuel

Thank you for this.
I have a question, how can the length of the arrow be either increase or reduce?

Chaorong Zhong

Easy and useful arrows fuction.

Anton Semechko

Good alternative to built-in 'quiver' function. Using arrow heads of fixed size makes visualization of vector fields much nicer.

Anton Semechko

Bijay Guha

Thank you..How can I skip data points in this plot?

Alessandro Masullo

@Jeison
Thank you for the suggestion, I updated the code.

Jeison Sosa

Hi there thanks for the function very useful! Just one comment on line 96 please change by
plot([x(:)'; Ct(:,1)'],[y(:)'; Ct(:,2)'],'-','linewidth',width,'color',col);

Sometimes the Color is given by a vector and not only by single letters (e.g. 'k', 'r', 'b', ...)

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!