How to plot to get the figure?

1 visualizzazione (ultimi 30 giorni)
Myo Gyi
Myo Gyi il 26 Mag 2020
Commentato: Myo Gyi il 18 Giu 2020
%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

Risposte (1)

darova
darova il 16 Giu 2020
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
  1 Commento
Myo Gyi
Myo Gyi il 18 Giu 2020
Thank You very much for your answer sir.. But I want to make the above figure, using the equation of Gramma = 4piU sir.. Thanks a lot.

Accedi per commentare.

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by