-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfoil_t_get.m
43 lines (33 loc) · 929 Bytes
/
foil_t_get.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function [tu_val, tl_val] = foil_t_get(fname, x_c)
load('aircraft_vars.mat', 'WING');
if strcmp(fname, 'biconvex')
tau_u = WING.biconvex(2).tc_u;
tau_l = WING.biconvex(2).tc_l;
tu_val = 2.*tau_u.*x_c.*(1 - x_c);
tl_val = 2.*tau_l.*x_c.*(1-x_c);
else
fid = fopen([fname '.dat'], 'r');
tline = fgets(fid);
coords = [];
i = 1;
while ischar(tline)
if ~isempty(str2num(tline))
coords(i,:) = str2num(tline);
% fprintf([tline '\n']);
i = i+1;
end
tline = fgets(fid);
end
fclose(fid);
nose = find(coords(:,1) == min(coords(:,1)));
top = coords(1:nose, :);
bot = coords((nose+1):end, :);
figure();plot(top(:,1), top(:,2));
hold on;
plot(bot(:,1), bot(:,2));
legend('Top', 'Bottom');
axis equal;
tu_val = abs(spline(top(:,1), top(:,2), x_c));
tl_val = abs(spline(bot(:,1), bot(:,2), x_c));
end
end