Somebody help me please. I want to make three figure. I have no idea to get these figure.
How to plot to get the figure?
1 次查看(过去 30 天)
显示 更早的评论
%Creation of streamline around the circle
a = 6; % Radius of Circle
V_i =50; % Velocity
G = 20; % Gramma (Circulation)
x=[-a*2:a/3:a*2];
[x]=meshgrid(x);
y=x';
for i=1:length(x);
for k=1:length(x);
if sqrt(x(i,k).^2+y(i,k).^2)<a;
x(i,k)=0;
y(i,k)=0;
end
end
end
r=sqrt(x.^2+y.^2);
% theta=atan2(y,x);
theta =pi-asin(-G/(4*pi*a*V_i));
ur=V_i*cos(theta).*(1-a^2./(r.^2));
ut=-V_i*sin(theta).*(1+a^2./(r.^2))-G./(2*pi*r);
u=ur.*cos(theta)-ut.*sin(theta);
v=ur.*sin(theta)+ut.*cos(theta);
%Creating The Filled Circle
t_r = 0:.1:2*pi;
xxx = a*cos(t_r);
yyy = a*sin(t_r);
%Vectors and Filled Circle plotting
figure(2)
hold on
quiver(x,y,u,v)
fill(xxx,yyy,'y')
axis square
title('streamline')
grid off
回答(1 个)
darova
2020-6-16
I just used these formulas from this page
The code i used
clc,clear
[x,y] = meshgrid(-3:0.2:3);
a = 1; % cylinder radius
U = 1; % flow velocity
G = 2.5*pi; % circulation
xmy = x.^2 - y.^2;
xpy = x.^2 + y.^2;
u = U*(1 - xmy*a^2./xpy.^2) + G/pi*y./xpy; % horizontal velocity
v = -2*U*x.*y*a^2./xpy.^2 - G/pi*x./xpy; % veftical velocity
[xc,yc] = pol2cart(deg2rad(0:10:360),1);
plot(xc,yc,'r','linew',2)
streamline(x,y,u,v,x(:,1),y(:,1))
streamline(x,y,u,v,x(1,:),y(1,:))
Results
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!