-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathgetchords.m
More file actions
77 lines (71 loc) · 2.58 KB
/
getchords.m
File metadata and controls
77 lines (71 loc) · 2.58 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
function [E,C]=getchords(X,plottaper)
% GETCHORDS calculate wing chord lengths
% [E,C]=GETCHORDS(X,PLOTTAPER) returns chords of a wing defined by the
% root, b/6 and b/3 chords in input X, which results in a wing closest to
% an elliptic planform. PLOTTAPER=1 plots the returned chords and an
% elliptic planform.
%
% Further global variables need to be set before calling GETCHORDS:
% wingParameters.b (wing span), wingParameters.weight (weight of aircraft
% minus the wing), wingParameters.loading (wing loading).
%
% -------------------------------------------------------------------------
% Aircraft Geometry Toolbox v0.1.0, Andras Sobester 2014.
%
% Sobester, A, Forrester, A I J, "Aircraft Aerodynamic Design - Geometry
% and Optimization", Wiley, 2014.
% -------------------------------------------------------------------------
%
% Copyright 2014 A I J Forrester
%
% This program is free software: you can redistribute it and/or modify it
% under the terms of the GNU Lesser General Public License as published by
% the Free Software Foundation, either version 3 of the License, or any
% later version.
%
% This program is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
% General Public License for more details.
%
% You should have received a copy of the GNU General Public License and GNU
% Lesser General Public License along with this program. If not, see
% <http://www.gnu.org/licenses/>.
global wingParameters
b=wingParameters.b;
L=wingParameters.weight+wingweight(b);
S=L/wingParameters.loading;
sectionLength=b/6;
chord0=X(1);
chord1=X(2);
chord2=X(3);
tr0=chord1/chord0;
tr1=chord2/chord1;
area0=(chord0+chord1)*sectionLength/2;
area1=(chord1+chord2)*sectionLength/2;
area2=S/2-area0-area1;
chord3=(2*area2/sectionLength)-chord2;
tr2=chord3/chord2;
stations=21;
stationLength=(b/2)/(stations-1);
x=0:stationLength:b/2;
% eliptic chords
idealProfile=sqrt(1-(x.*2./b).^2);
idealRoot=(S/2)/sum((idealProfile(1:end-1)+idealProfile(2:end)).*stationLength/2);
idealChords=idealProfile.*idealRoot;
for i=1:stations
if x(i)<=sectionLength
C(i)=chord0*(tr0+(1-tr0)*((sectionLength-x(i))/sectionLength));
elseif x(i)<=sectionLength*2
C(i)=chord1*(tr1+(1-tr1)*((sectionLength*2-x(i))/sectionLength));
else
C(i)=chord2*(tr2+(1-tr2)*((sectionLength*3-x(i))/sectionLength));
end
end
if exist('plottaper','var')==1
figure
plot(x,C)
hold on
plot(x,idealChords,'r')
end
E=mean((C(1:end-2)-idealChords(1:end-2)).^2);