Skip to content

Commit e1bd0e3

Browse files
committed
Code_Lenth
1 parent cd0044b commit e1bd0e3

7 files changed

+148
-0
lines changed

Code/NACA_Source_caculattion.m

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
%% 计算J值
2+
% 从txt文件中读取x,y
3+
clc
4+
a = load("NACA23021.dat")
5+
x = a(:,1)
6+
y = a(:,2)
7+
x_control = []
8+
y_control = []
9+
Q = []
10+
for i = 1:1:length(x)-1
11+
x_control(end + 1)=(x(i)+x(i+1))/2;
12+
y_control(end + 1)=(y(i)+y(i+1))/2;
13+
Q(end +1) = atan2(y_control(i),x_control(i))-pi/2;
14+
end
15+
16+
k1 = 15.957;
17+
m = 0.2025;
18+
x1 = [0:0.01:m];
19+
x2 = [m:0.01:1];
20+
y1 = k1/6*(x1.^3-3*m*x1.^2+m^2*(3-m)*x1);
21+
y2 = k1*m^3/6*(1-x2);
22+
23+
plot(x1,y1)
24+
hold on
25+
plot(x2,y2)
26+
hold on
27+
plot(x,y,'-o')
28+
axis([0 1 -0.2 0.2])
29+
hold on
30+
scatter(x_control,y_control,'red','*')
31+
hold off
32+
33+
%% 将之前的source_panel的方法进行移植
34+
clc
35+
syms s
36+
Ans = [];
37+
V_num = [];
38+
a = 34;
39+
sum = 0;
40+
All_Metric = zeros(a);
41+
for i = 1:1:a
42+
for j = 1:1:a
43+
A = -( x_control(i)-x(j) )*cos(Q(j))-(y_control(i)-y(j))*sin(Q(j));
44+
B = ( x_control(i)-x(j) )^2 + (y_control(i) - y(j))^2;
45+
C = sin(Q(i)-Q(j));
46+
D = (y_control(i)-y(j))*cos(Q(i))-(x_control(i)-y(j))*sin(Q(i));
47+
sj = ((x(j+1)-x(j))^2 +(y(j+1)-y(j))^2 )^0.5;
48+
I = (C*s+D)/(s^2 + 2*A*s+B);
49+
IS = int(I,s,0,sj);
50+
vpa(IS,5);
51+
Ans(end + 1) = IS;
52+
All_Metric(i,j) = Ans(end);
53+
end
54+
i
55+
Ans
56+
Ans = [];
57+
end
58+
%% 结果计算
59+
All_Metric
60+
V_num = [];
61+
62+
63+
Result = -inv(All_Metric)*cos(Q(1:1:a))'%再次简化
64+
save Result.txt -ascii Result;
65+
for i = 1:1:a
66+
for j = 1:1:a
67+
sum = sum + Result(j)*All_Metric(i,j);
68+
end
69+
V_num(end+1) = sum + sin(Q(i));
70+
sum = 0;
71+
end
72+
length(Q(1:1:a))
73+
length(V_num)
74+
cp
75+
cp = 1-(V_num).^2;
76+
figure(1)
77+
scatter(Q,cp)
78+
figure(2)
79+
scatter(x_control,cp)
80+
axis([0 1 -1 1])

Code/Result.txt

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
5.8331094e-02
2+
-2.6643527e-02
3+
1.1731417e-02
4+
-6.4532944e-03
5+
3.1467395e-03
6+
-4.4036320e-03
7+
-3.0530410e-03
8+
-9.1384948e-03
9+
-2.7866068e-02
10+
-3.2792751e-03
11+
-2.2922471e-02
12+
-3.6848363e-02
13+
-1.9448650e-01
14+
4.1758096e-01
15+
-5.4945495e-01
16+
3.3327039e-01
17+
-1.0735972e+00
18+
-1.0557653e+01
19+
3.8561956e+01
20+
-2.9881418e+01
21+
1.8842601e+01
22+
-1.2407944e+01
23+
6.4004518e+00
24+
-3.5304391e+00
25+
2.2495693e+00
26+
-1.4423589e+00
27+
7.5542089e-01
28+
-4.0802007e-01
29+
2.8100809e-01
30+
-1.7410272e-01
31+
1.2544494e-01
32+
-7.5817848e-02
33+
7.9357452e-02
34+
-5.3557976e-02

Code/Result/Cp_related_to_X.fig

23.9 KB
Binary file not shown.

Code/Result/First_Try.fig

24.4 KB
Binary file not shown.

Code/afile.txt

+34
Large diffs are not rendered by default.

可视化/Cp_related_to_X.fig

23.9 KB
Binary file not shown.

可视化/First_Try.fig

24.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)