Created
October 6, 2016 22:38
-
-
Save samstewart/7a35ac582f30ae8501e6f3eba55c04e2 to your computer and use it in GitHub Desktop.
Plot a 3D array representing a vector field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% plots a 3D array representing a vector field in grid coordinates (1, 1), | |
% (1, 2), etc. | |
function plot_vector_field(field) | |
N = size(field, 1); | |
M = size(field, 2); | |
[x,y] = meshgrid(1:1:N, 1:1:M) | |
u = field(:, :, 1); | |
v = field(:, :, 2); | |
quiver(x,y,u,v); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment