Somebody help me for my exercise please.
Afficher commentaires plus anciens

clc
clear
close all
% %% UNIFORM FLOW
[r,theta] = meshgrid(r,theta) ;
phiflow = -U*r.*sin(theta);
psiflow = U*r.*cos(theta);
W = sqrt(phiflow.^2+psiflow.^2) ;
figure(1)
% pcolor(r,theta,W);
quiver(r,theta,psiflow,phiflow)
grid on
%% SOURCE
phisource= -(Q /((2*pi)*(log (r))));
psisource = Q/(2*pi)*(theta);
W = sqrt(phisource.^2+psisource.^2) ;
figure(2)
% pcolor(r,theta,W);
quiver(r,theta,psisource,phisource)
grid on
%% SINK
phisink= (Q /((2*pi)*(log (r))));
psisink = -(Q/(2*pi)*(theta));
W = sqrt(phisink.^2+psisink.^2) ;
figure(3);
% pcolor(r,theta,W);
quiver(r,theta,psisink,phisink)
grid on
%% DOUBLET
phidoublet= -D/(2*pi)*cos(theta)/r;
psidoublet= -D/(2*pi)*sin(theta)/r;
W = sqrt(phidoublet.^2+psidoublet.^2) ;
figure(4);
% pcolor(r,theta,W);
quiver(r,theta,psidoublet,phidoublet)
grid on
%% VORTEX
phivortex = gamma.*/(2*pi).theta;
psivortex= gamma.*/(2*pi)*log(r);
W = sqrt(phivortex.^2+psivortex.^2) ;
figure(4);
% pcolor(r,theta,W);
quiver(r,theta,psivortex,phivortex)
grid on
Réponse acceptée
Plus de réponses (1)
clc
clear
close all
U=200; %velocity
gamma=1000; %circulation
Q=14; %volume flux of fluid
D=100; %doublet strenght
theta = linspace(0,360,500)*pi/180
%to create variables r
nx=500;
xin=-5;
xfin=5;
r=linspace(xin,xfin,nx);
%to create variables x and y
nx=500;
xin=-1000;
xfin=1000;
x=linspace(xin,xfin,nx);
ny=500;
yin=-1000;
yfin=1000;
y=linspace(yin,yfin,ny);
% %% UNIFORM FLOW
phiflow = U*r.*sin(theta);
psiflow = U*r.*cos(theta);
figure(1)
plot(phiflow,psiflow,'.-');
hold on
lgd=legend('\psi is green','\phi is blue');
lgd.Title.String = 'UNIFORM FLOW';
lgd.Title.FontSize = 10;
% quiver(x,y,psiflow,phiflow,0.75,'r')
axis equal
grid on
%% SOURCE
phisource= -(Q /(2*pi))*(log (r));
psisource = (Q/(2*pi))*(theta);
figure(2);
plot(phisource,psisource,'.-');
hold on
lgd=legend('\psi is green','\phi is blue');
lgd.Title.String = 'SOURCE FLOW';
lgd.Title.FontSize = 10;
% quiver(x,y,phisource,psisource,0.75,'r')
axis equal
grid on
%% SINK
phisink= (Q /(2*pi))*(log (r));
psisink = -(Q/(2*pi))*(theta);
figure(3);
plot(phisink,psisink,'.-');
hold on
lgd=legend('\psi is green','\phi is blue');
lgd.Title.String = 'SINK FLOW';
lgd.Title.FontSize = 10;
% quiver(x,y,psisink,phisink,0.75,'r')
axis equal
grid on
%% DOUBLET
phidoublet= -(D)*cos(theta)./max(r);
psidoublet= -(D)*sin(theta)./max(r);
figure(4);
plot(phidoublet,psidoublet,'.-');
hold on
lgd=legend('\psi is green','\phi is blue');
lgd.Title.String = 'DOUBLET FLOW';
lgd.Title.FontSize = 10;
% quiver(x,y,phidoublet,psidoublet,0.75,'r')
% axis equal
grid on
%% VORTEX
phivortex = (gamma/(2*pi))*theta;
psivortex= (gamma/(2*pi))*log(r);
figure(5);
plot(phivortex,psivortex,'.-');
hold off
lgd=legend('\psi is green','\phi is blue');
lgd.Title.String = 'VORTEX FLOW';
lgd.Title.FontSize = 10;
% quiver(x,y,phivortex,psivortex,0.75,'r')
% axis equal
grid on
6 commentaires
VBBV
le 7 Nov 2022
Try with quiver function to get arrow plots
Myo Gyi
le 7 Nov 2022
VBBV
le 7 Nov 2022
Since this is homework exercise try the remaining part by yourself. Check how plots vary by considering both real and imaginary values for stream line velocity potential functions
clc
clear
close all
U=200; %velocity
gamma=1000; %circulation
Q=14; %volume flux of fluid
D=100; %doublet strenght
% theta = linspace(0,360,500)*pi/180
%to create variables r
nx=500;
xin=-5;
xfin=5;
r=linspace(xin,xfin,nx);
%to create variables x and y
nx=500;
xin=-1000;
xfin=1000;
x=linspace(xin,xfin,nx);
ny=500;
yin=-1000;
yfin=1000;
y=linspace(yin,yfin,ny);
[X Y] = meshgrid(x,y);
% %% UNIFORM FLOW
phiflow = U*X; %r.*sin(theta);
psiflow = U*Y;%.*cos(theta);
figure(1)
quiver(X(1:50:end,1:50:end),Y(1:50:end,1:50:end),phiflow(1:50:end,1:50:end),psiflow(1:50:end,1:50:end))
hold on
lgd=legend('\psi is green','\phi is blue');
lgd.Title.String = 'UNIFORM FLOW';
lgd.Title.FontSize = 10;
% quiver(x,y,psiflow,phiflow,0.75,'r')
axis equal
grid on
An example how quiver plots can be done are found at https://in.mathworks.com/help/matlab/ref/quiver.html
Myo Gyi
le 8 Nov 2022
Catégories
En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!








