代码:
%一部分流线
clc;clear
d = 10;
hold on
for i = 1:100
c0 = 0.01*i;
c = (1-c0)/(2*c0);
theta0 = atan(1/c);
rs = d^2*(1+1/c^2);
r = sqrt(rs);
theta = -theta0:0.1:pi+theta0;
%theta = 0:0.01:2*pi;
x = r*cos(theta);
y = d/c+r*sin(theta);
plot(x,y)
plot(x,-y)
end
grid on
axis equal
axis([-35 35 -35 35])
hold off
%另一部分流线
clc;clear
d = 10;
hold on
for i = 1:100
c0 = 0.01*i;
c = (1-c0)/(2*c0);
theta0 = atan(1/c);
rs = d^2*(1+1/c^2);
r = sqrt(rs);
theta = theta0:0.1:pi-theta0;
%theta = 0:0.01:2*pi;
x = r*cos(theta);
y = -d/c+r*sin(theta);
plot(x,y)
plot(x,-y)
end
grid on
axis equal
axis([-35 35 -35 35])
hold off
%绘制舌进
clc
clear
al = 1;
d = 10;
hold on
t0 = 500;
for i = 1:70
c0 = 0.01*i;
c = (1-c0)/(2*c0);
theta0 = atan(1/c);
rs = d^2*(1+1/c^2);
r = sqrt(rs);
theta1 = -theta0:0.01:pi;
n = length(theta1);
for i = 1:n
t = quad(@(theta)fun(theta,r,d,c,al),-theta0,theta1(i));
if t >= t0
the = theta1(i);
break
end
end
x = r*cos(the);
y = r*sin(the)+d/c;
plot(x,y,'r.')
plot(x,-y,'r.')
end
for i = 71:98
c0 = 0.01*i;
c = (1-c0)/(2*c0);
theta0 = atan(1/c);
rs = d^2*(1+1/c^2);
r = sqrt(rs);
theta1 = -theta0:0.0001:pi;
n = length(theta1);
for i = 1:n
t = quad(@(theta)fun(theta,r,d,c,al),-theta0,theta1(i));
if t >= t0
the = theta1(i);
break
end
end
x = r*cos(the);
y = r*sin(the)+d/c;
plot(x,y,'r.')
plot(x,-y,'r.')
end
%2
for i = 1:100
c0 = 0.01*i;
c = (1-c0)/(2*c0);
theta0 = atan(1/c);
rs = d^2*(1+1/c^2);
r = sqrt(rs);
theta2 = theta0:0.01:pi;
n = length(theta2);
for i = 1:n
t = quad(@(theta)fun2(theta,r,d,c,al),theta0,theta2(i));
if t >= t0
the = theta2(i);
break
end
end
x = r*cos(the);
y = r*sin(the)-d/c;
plot(x,y,'r.')
plot(x,-y,'r.')
end
%调用函数1
function f = fun(theta,r,d,c,al)
f = r/al*(sqrt((r*cos(theta)-d).^2+(r*sin(theta)+d/c).^2).*sqrt((r*cos
(theta)+d).^2+(r*sin(theta)+d/c).^2));
%调用函数2
function f = fun2(theta,r,d,c,al)
f = r/al*(sqrt((r*cos(theta)-d).^2+(r*sin(theta)-d/c).^2).*sqrt((r*cos
(theta)+d).^2+(r*sin(theta)-d/c).^2));