How do you make a Moving Quiver Plot ?

2 views (last 30 days)
James McGinley
James McGinley on 25 Apr 2019
Edited: James McGinley on 25 Apr 2019
I am trying to use a quiver plot to plot the velocity field. The exact solution should be able to move to a certain location, however when I attempt to create a code to show this, my graph just changes colors. Any advice on how to fix this?
clear
clc
close all
%Start with all given variables
%Number of grid points
N = 31;
%This is in both x and y direction
Nx = N;
Ny = N;
%Viscousity is 1e -1
mu = 1e-1;
% The Domain is 2pi
L=2*pi;
% The domain is the same in both x and y
Lx = L;
Ly = L;
dx = Lx/(Nx-1);
dy = Ly/(Ny-1);
NXX = 33; NYY = 33;
XLin = linspace(0,Lx,NXX);
YLin = linspace(0,Ly,NYY);
% Create N equally spaced values between 0 and L in both directions
xlin = linspace(0,Lx,Nx);
ylin = linspace(0,Ly,Ny);
[x,y] = meshgrid(xlin,ylin);
x=x';
y=y';
u_exact = zeros(31,31);
v_exact = zeros(31,31);
T = 0;
for n = 1:1000
u_exact = cos(x)*sin(y)*exp(-2*mu*T);
v_exact = -sin(x)*cos(y)*exp(-2*mu*T);
figure(3)
hold on
quiver(x,y,u_exact,v_exact)
pause(0.01)
title('The Exact Value of Taylor-Green vortex')
T = T+ 0.01;
end

Answers (0)

Categories

Find more on Vector Fields in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!