Plotting a rankine half body
Mostrar comentarios más antiguos
I'm trying to plot a rankine half body, a flow field formed by superposition of a horizontal uniform flow and a source flow. The figure turned out to be a mess, I don't know how I should fix it. Here are my codes:
clc;
clear all;
m=3; %strength
U = 30;%positive x-axis
%Mesh for fourth quadrant and corresponding stream value function
[X1,Y1] = meshgrid(.05:.1:30,-30:.1:-.05);
psi1 = U*Y1 + (m/(2*pi))*atan(Y1./X1);
%Mesh for first quadrant and corresponding stream value function
[X2,Y2] = meshgrid(.05:.1:30,.05:.1:30);
psi2 = U*Y2 + (m/(2*pi))*atan(Y2./X2);
%Mesh for second quadrant and corresponding stream value function
[X3,Y3] = meshgrid(-30:.1:-.05,.05:.1:30);
psi3 = U*Y3 + (m/(2*pi))*atan(Y3./X3);
%Mesh for third quadrant and corresponding stream value function
[X4,Y4] = meshgrid(-30:.1:-.05,-30:.1:-.05);
psi4 = U*Y4 + (m/(2*pi))*atan(Y4./X4);
figure (1)
A='on';
B = 2;
C = 2.5;
contour(X1,Y1,psi1,'k','showtext',A,'textstep',B,'levelstep',C);
hold on;
contour(X2,Y2,psi2,'k','showtext',A,'textstep',B,'levelstep',C);
hold on;
contour(X3,Y3,psi3,'k','showtext',A,'textstep',B,'levelstep',C);
hold on;
contour(X4,Y4,psi4,'k','showtext',A,'textstep',B,'levelstep',C);
hold off;
xlim([-30 30]);ylim([-30 30]);
xlabel('X');ylabel('Y');
grid on;
'''
Here is the figure I got:

However, it should at least look something like this:

Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Motion Modeling and Coordinate Systems en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
