Somebody help me for my exercise please.

15 visualizzazioni (ultimi 30 giorni)
Myo Gyi
Myo Gyi il 7 Nov 2022
Modificato: Myo Gyi il 8 Nov 2022
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

Risposta accettata

KSSV
KSSV il 7 Nov 2022
This is how you have to proceed.
U=200; %velocity
gamma=1000; %circulation
Q=14; %volume flux of fluid
D=100; %doublet strenght
theta = 0;
%to create variables r
nx=100;
xin=-5;
xfin=10;
theta = linspace(0,2*pi,nx) ;
r=linspace(xin,xfin,nx);
%to create variables x and y
nx=500000;
xin=-1000;
xfin=1000;
x=linspace(xin,xfin,nx);
ny=500000;
yin=-1000;
yfin=1000;
y=linspace(yin,yfin,ny);
% %% 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)
  2 Commenti
Myo Gyi
Myo Gyi il 7 Nov 2022
Sorry sir...
I want to plot one by one picture. For example, for uniform flow, source and sink flow, like that sir....
But I don`t have idea for my exercise. I want to show 6 pictures Sir.. Please

Accedi per commentare.

Più risposte (1)

VBBV
VBBV il 7 Nov 2022
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
theta = 1×500
0 0.0126 0.0252 0.0378 0.0504 0.0630 0.0755 0.0881 0.1007 0.1133 0.1259 0.1385 0.1511 0.1637 0.1763 0.1889 0.2015 0.2141 0.2266 0.2392 0.2518 0.2644 0.2770 0.2896 0.3022 0.3148 0.3274 0.3400 0.3526 0.3652
%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');
Warning: Ignoring extra legend entries.
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,'.-');
Warning: Imaginary parts of complex X and/or Y arguments ignored.
hold on
lgd=legend('\psi is green','\phi is blue');
Warning: Ignoring extra legend entries.
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,'.-');
Warning: Imaginary parts of complex X and/or Y arguments ignored.
hold on
lgd=legend('\psi is green','\phi is blue');
Warning: Ignoring extra legend entries.
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');
Warning: Ignoring extra legend entries.
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,'.-');
Warning: Imaginary parts of complex X and/or Y arguments ignored.
hold off
lgd=legend('\psi is green','\phi is blue');
Warning: Ignoring extra legend entries.
lgd.Title.String = 'VORTEX FLOW';
lgd.Title.FontSize = 10;
% quiver(x,y,phivortex,psivortex,0.75,'r')
% axis equal
grid on
  6 Commenti
VBBV
VBBV il 7 Nov 2022
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');
Warning: Ignoring extra legend entries.
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
Myo Gyi il 8 Nov 2022
Thank you very much sir... But I don`t get the right answer I wan to plot another figure sir....

Accedi per commentare.

Categorie

Scopri di più su Vector Fields 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