필터 지우기
필터 지우기

How do you make a Moving Quiver Plot ?

조회 수: 3 (최근 30일)
James McGinley
James McGinley 2019년 4월 25일
편집: James McGinley 2019년 4월 25일
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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Vector Fields에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by