-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdatcom3d_template.m
executable file
·107 lines (85 loc) · 4.99 KB
/
datcom3d_template.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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
%*************************************************************************
% The source code contained herein was developed for Embry-Riddle
% Aeronautical University by Glenn P. Greiner, Professor and Jafar
% Mohammed, Student Assistant of the Aerospace Engineering Department,
% Daytona Beach Campus. Copyright 2008. All rights reserved.
% Although due care has been taken to present accurate programs this
% software is provided "as is" WITHOUT WARRANTY OF ANY KIND, EITHER
% EXPRESSED OR IMPLIED, AND EXPLICITLY EXCLUDING ANY IMPLIED WARRANTIES
% OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. The entire risk as
% to the quality and performance of the software is with the user. The
% program is made available only for education and personal research. It
% may not be sold to other parties. If you copy some or all of the
% software you are requested to return a copy of any source additions that
% you believe make a significant improvement in its range of application.
%*************************************************************************
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% datcom3d v1.2 Input File %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear
clc
clf
%%% VISUALIZATION and RESOLUTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
wframe = 1; %0 = Shaded model
%1 = Wireframe model (default)
fusres = 20; %Fuselage resolution
wgres = 20; %Wing,HT,VT resolution
%%% (DO NOT CHANGE VALUES IN THIS BOX) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
XW=0;ZW=0;ALIW=0;XH=0;ZH=0;ALIH=0;XV=0;ZV=0;YV=0;numVT=1;VERTUP=1; %%
NX=0;X=zeros(20);S=zeros(20);R=zeros(20);ZU=zeros(20);ZL=zeros(20); %%
CHRDR_WG=0;CHRDBP_WG=0;CHRDTP_WG=0;SSPN_WG=0;SSPNOP_WG=0;SAVSI_WG=0; %%
SAVSO_WG=0;CHSTAT_WG=0;DHDADI_WG=0;DHDADO_WG=0;TC_WG=.12; %%
CHRDR_HT=0;CHRDBP_HT=0;CHRDTP_HT=0;SSPN_HT=0;SSPNOP_HT=0;SAVSI_HT=0; %%
SAVSO_HT=0;CHSTAT_HT=0;DHDADI_HT=0;DHDADO_HT=0;TC_HT=.12; %%
CHRDR_VT=0;CHRDBP_VT=0;CHRDTP_VT=0;SSPN_VT=0;SSPNOP_VT=0;SAVSI_VT=0; %%
SAVSO_VT=0;CHSTAT_VT=0;TC_VT=.12; %%
SPANFI_F=0;SPANFO_F=0;CHRDFI_F=0;CHRDFO_F=0;DELTA_F=0; %%
SPANFI_A=0;SPANFO_A=0;CHRDFI_A=0;CHRDFO_A=0;DELTAL_A=0;DELTAR_A=0; %%
SPANFI_E=0;SPANFO_E=0;CHRDFI_E=0;CHRDFO_E=0;DELTA_E=0; %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% INPUT PARAMETERS BELOW %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SYNTHS parameters
% BODY parameters
% WING parameters (add suffix "_WG" to variables)
% WING FLAPS (add suffix "_F" to variables)
% WING AILERONS (add suffix "_A" to variables)
% HORIZONTAL TAIL parameters (add suffix "_HT" to variables)
% ELEVATOR (add suffix "_E" to variables)
% VERTICAL TAIL parameters (add suffix "_VT" to variables)
% For twin vertical tails, you need to define:
% numVT - number of vertical tails (for twin VT, should be 2)
% YV - distance from FRL to stb. VT vertex
%%% PLOTTING %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
warning off MATLAB:divideByZero
hold on
plotFuselage(NX,X,S,R,ZU,ZL,fusres)
plotWing(XW,ZW,ALIW,CHRDR_WG,CHRDBP_WG,CHRDTP_WG,SSPN_WG,SSPNOP_WG,SAVSI_WG,SAVSO_WG,CHSTAT_WG,DHDADI_WG,DHDADO_WG,...
SPANFI_F,SPANFO_F,CHRDFI_F,CHRDFO_F,DELTA_F,SPANFI_A,SPANFO_A,CHRDFI_A,CHRDFO_A,DELTAL_A,DELTAR_A,TC_WG,wgres)
plotHT(XH,ZH,ALIH,CHRDR_HT,CHRDBP_HT,CHRDTP_HT,SSPN_HT,SSPNOP_HT,SAVSI_HT,SAVSO_HT,CHSTAT_HT,DHDADI_HT,DHDADO_HT,...
SPANFI_E,SPANFO_E,CHRDFI_E,CHRDFO_E,DELTA_E,TC_HT,wgres)
plotVT(XV,YV,ZV,CHRDR_VT,CHRDBP_VT,CHRDTP_VT,SSPN_VT,SSPNOP_VT,SAVSI_VT,SAVSO_VT,CHSTAT_VT,VERTUP,TC_VT,wgres)
if numVT > 1
plotVT(XV,-YV,ZV,CHRDR_VT,CHRDBP_VT,CHRDTP_VT,SSPN_VT,SSPNOP_VT,SAVSI_VT,SAVSO_VT,CHSTAT_VT,VERTUP,TC_VT,wgres)
end
%%% VIEWPORT/FIGURE PROPERTIES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if wframe == 0
%colormap([1 .7 .1]) %Set a/c to gold
colormap([0 0 1]) %Set a/c to blue
shading interp %Interpolated shading
lighting gouraud %Smooth airplane mesh
%camlight right %Apply a light source
%Custom Lighting Options, Note:[X Y Z]
light('Position',[1 -2 1],'Style','infinite');
light('Position',[1 2 1],'Style','infinite');
light('Position',[0 0 -6],'Style','infinite');
else
colormap([1 1 1]) %Set a/c to white
end
axis off %Turn off axis
axis equal %Correct aspect ratio
%camva(4.5) %Zoom in a/c to fit figure
view(3) %Apply initial viewport rotation
%camproj('perspective') %Perspective viewing (not R2006a compatible)
rotate3d on %Rotate icon enabled at start up
%showplottool('plotbrowser') %Enable the plot browser on startup
set(gcf,'NumberTitle','off','Name','Aircraft Plot','Color',[1 1 1]);