clear
close all
clc
x = -10:0.1:10;
y = -15:0.1:0;
for i = 1:length(y)
for j = 1:length(x)
if x(j)<-5 || x(j)>=5
A = 10;
gradA = 0;
if y(i)<-10
u(i,j) = 0;
v(i,j) = 0;
else
u(i,j) = 200/A;
v(i,j) = (200/(A*A))*gradA*y(i);
end
elseif x(j)>=-5 && x(j)<0
A = 5-x(j);
gradA = -1;
if y(i)-x(j)+5>=0
u(i,j) = 200/A;
v(i,j) = (200/(A*A))*gradA*y(i);
else
u(i,j) = 0;
v(i,j) = 0;
end
else
A = 5+x(j);
gradA = 1;
if y(i)+x(j)+5>=0
u(i,j) = 200/A;
v(i,j) = (200/(A*A))*gradA*y(i);
else
u(i,j) = 0;
v(i,j) = 0;
end
end
end
end
quiver(x,y,u,v);
xlabel('X');
ylabel('Y');
title('Vector plot of velocity field');
axis tight
grid on
Hi.
I am trying to run the above piece of code. It gives the quiver plot of the fluid velocity. Anyways, some of the velocity vectors are missing from the plot and I just cannot understand why. When you run the code, look for the vectors on the innermost side (the ones that make up the triangle edges). You will see that there are some vectors missing on the triangle edge. Can anyone explain why is this happening and where am I going wrong? I am attaching the image in case you are unable to run the code right now.
Thanks!