2
votes

I have a triangulation of the unit square and the x- and y-components of a vector field for each node of this triangulation.

What I'd like to do is plot the vector field over the triangular mesh, but so far I've been unable to find a way to do this. Matlab's quiver-command requires a meshgrid, which I don't have.

Is there a way to plot something like this?

1

1 Answers

1
votes

MATLAB's quiver does not require a meshgrid input. You can specify any arbitrary x,y, u, and v as long as they are the same size:

t = linspace(0, 2*pi, 100);
q = quiver(t, sin(t), sin(t), sin(t));

enter image description here

The only time that it requires a meshgrid input is if you don't want to fully specify x and y:

[xx,yy] = meshgrid(1:10, 1:10);

%// Notice that for x and y we only provide vectors while xx/yy are matrices
q = quiver(1:10, 1:10, xx, yy);

enter image description here