Dec
9
كتبه :
ZerO
12/9/2009 2:57 AM
Performance
short g all ...,% Main Figure 'units','normalized','Position',[0 0 1 1],...
'numbertitle','off','Name','Performance .',...
pm.g = uibuttongroup (
'toolbar','figure','visible','on','color',[1 1 1 ],'resize','off');...,% Main Input panel
'parent',f,'Title','Main Input Panel : ',...
ha = axes(
set([f,ha],
movegui(f,
'Position',[.83 .095 .165 .84],'BackgroundColor',[1 1 1]);'parent',f,'Position',[.05 .1 .75 .85],'color',[1 1 1 ]); 'Units','normalized')'center')
%% Toolbar Icons :
tb = findall (f,
ed1 = uipushtool (tb,
'Type','uitoolbar');'CData',iconRead(fullfile(matlabroot,...
'toolbox\matlab\icons\textcolor.mat')),...
'TooltipString','save Input','separator','on',...
ed2 = uipushtool (tb,
'HandleVisibility','off','enable','off');'CData',iconRead(fullfile(matlabroot,...
'toolbox\matlab\icons\arrow.mat')),...
'TooltipString','Load Input',...
main
'HandleVisibility','off','enable','off'); %% <> %%
%%
function
pm.step = uibuttongroup (
main ...,% Slider-Step panel
'parent',pm.g,'Title','Slider Step : ',...
'Pos',[0 .85 1 .1],'BackgroundColor',[1 1 1]);%'bordertype','line','ForegroundColor',[1 1 1 ]);
pm.r1 = uicontrol (
'parent',pm.step,'Style','Radio','String','Step Default',...
pm.r2 = uicontrol (
'units','normalized','pos',[0 .66 .5 .3],'BackgroundColor',[1 1 1]);'parent',pm.step,'Style','Radio','String','Step *10',...
pm.r3 = uicontrol (
'units','normalized','pos',[.25 0.33 .5 .3],'BackgroundColor',[1 1 1]);'parent',pm.step,'Style','Radio','String','Step *100',...
set(pm.step,
'units','normalized','pos',[.5 0 .5 .3],'BackgroundColor',[1 1 1]); 'SelectionChangeFcn',{@change,1},'SelectedObject',[])
%%
pm.cd0 = uicontrol (
'parent',pm.g,'Style','text','String',...
[
'Zero-Lift Drag (Cdo) = ',num2str(0)],'units','normalized',...
pm.cd0slider = uicontrol (
'Position',[0 .8 .9 .05]);'parent',pm.g,'Style','slider','Max',1,'Min',0,...
'Value',0,'SliderStep',[1/1000 1],...
'units','normalized','Position',[.9 .8 .1 .05],...
pm.k = uicontrol (
'callback',{@slid,26}); 'parent',pm.g,'Style','text','String',...
[
'Drag Constant (K) = ',num2str(0)],'units','normalized',...
pm.kslider = uicontrol (
'Position',[0 .75 .9 .05]);'parent',pm.g,'Style','slider','Max',1,'Min',0,...
'Value',0,'SliderStep',[1/1000 1],...
'units','normalized','Position',[.9 .75 .1 .05],...
pm.w = uicontrol (
'callback',{@slid,27}); 'parent',pm.g,'Style','text','String',...
[
'Vehicle Weight = ',num2str(0)],'units','normalized',...
pm.wslider = uicontrol (
'Position',[0 .7 .9 .05]);'parent',pm.g,'Style','slider','Max',100000,'Min',0,...
'Value',0,'SliderStep',[1/2000 1],...
'units','normalized','Position',[.9 .7 .1 .05],...
pm.s = uicontrol (
'callback',{@slid,28}); 'parent',pm.g,'Style','text','String',...
[
'Wing Surface Area = ',num2str(0)],'units','normalized',...
pm.sslider = uicontrol (
'Position',[0 .65 .9 .05]);'parent',pm.g,'Style','slider','Max',2000,'Min',0,...
'Value',0,'SliderStep',[1/2000 1],...
'units','normalized','Position',[.9 .65 .1 .05],...
pm.sw = uicontrol(
'callback',{@slid,29}); 'parent',pm.g,'Style','text','String',...
[
'Leading Edge SweepBack = ',num2str(0)],...
'tooltipstring',[num2str(0),' Degrees',num2str(0),' Radians'],...
pm.swslider = uicontrol(
'units','normalized','Position',[0 .6 .9 .05]);'parent',pm.g,'Style','slider','Max',90,'Min',-90,...
'Value',0,'SliderStep',[1/1800 1],...
'units','normalized','Position',[.9 0.6 .1 .05],...
pm.alt = uicontrol(
'callback',{@slid,30}); 'parent',pm.g,'Style','text','String',...
[
'Altitude = ',num2str(0)],'units','normalized',...
pm.altslider = uicontrol(
'Position',[0 .55 .9 .05]);'parent',pm.g,'Style','slider','Max',25000,'Min',0,...
'Value',0,'SliderStep',[1/25000 1],...
'units','normalized','Position',[.9 .55 .1 .05],...
pm.vel = uicontrol(
'callback',{@slid,31}); 'parent',pm.g,'Style','text','String',...
[
'Free Stream Velocity = ',num2str(0)],'units','normalized',...
pm.velslider = uicontrol(
'Position',[0 .5 .9 .05]);'parent',pm.g,'Style','slider','Max',1000,'Min',0,...
'Value',0,'SliderStep',[1/1000 1],...
'units','normalized','Position',[.9 .5 .1 .05],...
'callback',{@slid,32});
%%
pm.en = uibuttongroup (
...,% En Panel
'parent',pm.g,'Pos',[0 .35 1 .15],'BackgroundColor',[1 1 1],...
pm.engine = uibuttongroup (
'bordertype','line','ForegroundColor',[1 1 1 ]);...,% Engine Panel
'parent',pm.en,'Title','Engine Type : ',...
pm.r4 = uicontrol (
'Pos',[0 0 .4 1],'BackgroundColor',[1 1 1]);'parent',pm.engine,'Style','Radio','String','Turbo-Prop',...
pm.r5 = uicontrol (
'units','normalized','pos',[0 .66 1 .3],'BackgroundColor',[1 1 1]);'parent',pm.engine,'Style','Radio','String','Turbo-Fan',...
pm.r6 = uicontrol (
'units','normalized','pos',[0 .33 1 .3],'BackgroundColor',[1 1 1]);'parent',pm.engine,'Style','Radio','String','Turbo-Jet',...
set(pm.engine,
'units','normalized','pos',[0 0 1 .3],'BackgroundColor',[1 1 1]);'SelectionChangeFcn',{@change,2},'SelectedObject',[])
%%
pm.flap = uibuttongroup (
...,% Flap Panel
'parent',pm.en,'Title','Flap Type : ',...
pm.r7 = uicontrol (
'Pos',[.4 0 .6 1],'BackgroundColor',[1 1 1]); 'parent',pm.flap,'Style','Radio','String','SingleSlotted',...
pm.r8 = uicontrol (
'units','normalized','pos',[0 .75 1 .3],'BackgroundColor',[1 1 1]);'parent',pm.flap,'Style','Radio','String','Fowler.SingleSlotted',...
pm.r9 = uicontrol (
'units','normalized','pos',[0 .50 1 .3],'BackgroundColor',[1 1 1]); 'parent',pm.flap,'Style','Radio','String','Fowler.DoubleSlotted',...
pm.r10 = uicontrol (
'units','normalized','pos',[0 .25 1 .3],'BackgroundColor',[1 1 1]);'parent',pm.flap,'Style','Radio','String','Fowler.TrippleSlotted',...
set(pm.flap,
'units','normalized','pos',[0 0 1 .3],'BackgroundColor',[1 1 1]);'SelectionChangeFcn',{@change,3})
%%
pm.units = uibuttongroup (
...,% Units Panel
'parent',pm.g,'Pos',[0 .3 1 .05],'BackgroundColor',[1 1 1],...
pm.r11 = uicontrol (
'bordertype','line','ForegroundColor',[1 1 1 ]); 'parent',pm.units,'Style','Radio','String','SI-Units',...
pm.r12 = uicontrol (
'units','normalized','pos',[.1 0 .5 1],'BackgroundColor',[1 1 1]);'parent',pm.units,'Style','Radio','String','English-Units',...
set(pm.units,
'units','normalized','pos',[.5 0 .5 1],'BackgroundColor',[1 1 1]);'SelectionChangeFcn',{@change,4},'SelectedObject',[])
%%
end
%%
% Main End
function
[m1,m2] = perform (src,evt) %#ok
f = gcf;
cdo = get (pm.cd0slider,
k = get (pm.kslider,
w = get (pm.wslider,
s = get (pm.sslider,
gama = get (pm.swslider,
alt = get (pm.altslider,
v = get (pm.velslider,
et = 1;
et = 2;
et = 3;
'value');'value');'value');'value');'value');'value');'value');if get(pm.r4,'value') == 1elseif get(pm.r5,'value') == 1elseif get(pm.r6,'value') == 1end
ft = 1;
ft = 2;
ft = 3;
ft = 4;
enp = get(pm.shaftslider,
enp(2) = get(pm.effslider,
if get(pm.r7,'value') == 1elseif get(pm.r8,'value') == 1elseif get(pm.r9,'value') == 1elseif get(pm.r10,'value') == 1end try get(pm.shaftslider,'value');'value');'value');catch enp = get(pm.avtslider,'value');end
o = [cdo k w s gama alt v et ft enp];
%%%%%%%% O %%%%%%%%
temps = altitude (alt);
s = s * 10.76391;
w = w * 2.20462;
alt = convlength(alt,
v = convvel(v,
if get(pm.r11,'value') == 1'm','ft');'m/s','ft/s');else
temp1 = convlength(alt,
temps = altitude (temp1);
alt = convlength(temp1,
'ft','m');'m','ft');end
wl = w/s;
rho = convdensity(temps(2),
speed = convvel(temps(3),
mach = v ./ speed;
[m1,m2] = quick(v);
v = (100:10:1300);
n1 = quick(v);
out(1)
pm.dplot = uicontrol(
'kg/m^3','slug/ft^3');'m/s','ft/s'); 'parent',pm.g,'style','pushbutton','units','normalized',...
'string','Drag Components','fontsize',10,...
pm.ldplot = uicontrol(
'pos',[0 .05 .5 .05],'Callback',{@out,2},'handlevisibility','on');'parent',pm.g,'style','pushbutton','units','normalized',...
'string','Lift-Drag Ratios','fontsize',10,...
pm.tplot = uicontrol(
'pos',[.5 .05 .5 .05],'Callback',{@out,3},'handlevisibility','on');'parent',pm.g,'style','pushbutton','units','normalized',...
'string','Thrust Curve','fontsize',10,...
pm.dplot = uicontrol(
'pos',[0 .1 .5 .05],'Callback',{@out,4},'handlevisibility','on');'parent',pm.g,'style','pushbutton','units','normalized',...
'string','Power Curve','fontsize',10,...
'pos',[.5 .1 .5 .05],'Callback',{@out,5},...
pm.rplot = uicontrol(
'handlevisibility','on'); 'parent',pm.g,'style','pushbutton','units','normalized',...
'string','Rate of Climb','fontsize',10,...
'pos',[0 .15 .5 .05],'Callback',{@out,6},...
pm.clcdplot = uicontrol(
'handlevisibility','on');'parent',pm.g,'style','pushbutton','units','normalized',...
'string','Drag Polar','fontsize',10,...
'pos',[.5 .15 .5 .05],'Callback',{@out,7},...
set(ed1,
set(ed2,
'handlevisibility','on'); 'clickedcallback',{@save_toolbar,o},'enable','on')'clickedcallback',{@load_toolbar},'enable','on')
%%
function
[m1,m2] = quick (velocity)
%% Calculate drag polar , min thrust/power required :
v = velocity ;
cl = (2*w) ./ (rho *s .* (v.^2));
cd = cdo + (k .* (cl.^2));
zd = 0.5 * rho * s * cdo .* (v.^2);
dl = 0.5 * rho * s * k .* (cl.^2) .* (v.^2);
d = 0.5 * rho * s .* (v.^2) .* cd;
tr = d;
ldmax = 1 / ( sqrt( 4 * cdo * k) );
vldmax = ( ( 2/rho ) * (sqrt( k / cdo )) * wl ) ^0.5;
ld2max = (3/4) * ( ( 1 / ( 3 * k * (cdo^3) ) ) ^0.25);
vld2max = ( (2/rho) * (sqrt( 3 * k / cdo ) ) *wl ) ^0.5;
ld3max = 0.25 * (3 / (k * (cdo^0.3333) ) ) ^(3/4);
vld3max = ((2/rho) * (sqrt( k / (3*cdo))) *wl ) ^0.5;
trmin = w * (sqrt( 4 * cdo * k) );
vtrmin = vldmax;
pr = (sqrt(( 2 * w^2 .* cd.^2 ) ./ (rho * s .* cl.^3) )) ./ 550;
prmin = sqrt(( 2 .* (( w ./ cl).^3) .* (cd.^2)) / (rho*s)) ./550;
vprmin = vld3max;
%% Power and thrust avialable :
if
prop(1) = get(pm.shaftslider,
prop(2) = get(pm.effslider,
ta = (prop(1)*550*prop(2))./v;
pa = (prop(1)*prop(2))*((rho/0.0023769)^0.7);
get(pm.r4,'value') == 1'value');'value');%needs check
%c = ta./w;
%vthetamax = ( 4 * wl * k ) / (rho * prop(2) * (prop(1)*550/w));
%thetamax = asind(c-(0.5*rho*(1/wl)*cdo*(vthetamax.^2))-(wl*2*k/(rho*(vthetamax.^2))));
thetamax = 0;
vthetamax = 0;
rcmaxtheta = vthetamax .* sind(thetamax);
p1 = prop(1)*550;
p2 = p1 * prop(2);
rc = (p2/w) - ( v.*(( 0.5*rho.*(v.^2).*(wl^-1).*cdo ) + ( wl.*(2*k)./(rho.*(v.^2))) ) );
vrcmax = vld3max;
rcmax = (p2/w) - ( (vrcmax)*(1.155/ldmax) );
elseif
ta = get(pm.avtslider,
pa = v.*ta ./550;
get(pm.r5,'value') == 1'value')*((rho/0.0023769)^0.6);
elseif
ta = get(pm.avtslider,
pa = v.*ta ./550;
get(pm.r6,'value') == 1'value')*(rho/0.0023769);
end
%% Climb Performance and V max/min/stall :
if
c = (ta./w);
vmax = (((c.*wl)+(wl.*(sqrt((c.^2)-(4*cdo*k)))))/(rho*cdo)).^0.5;
get(pm.r4,'value') == 1
else
c = ta./w;
vmax = (((c*wl)+(wl*(sqrt((c^2)-(4*cdo*k)))))/(rho*cdo))^0.5;
sthetamax = c-(1/ldmax);
thetamax = asind(sthetamax);
vthetamax = sqrt((2/rho)*(k/cdo)^0.5*(wl*cosd(thetamax)));
rcmaxtheta = vthetamax .* sind(thetamax);
rc = ((pa-prmin)./w) .*550;
z = 1+sqrt(1+3/ldmax.*c.^2);
rcmax = (wl.*z./(3*rho*cdo))^0.5 .* (c.^1.5) .* ( 1-(z/6)-3 ./ (2.*c.^2.*ldmax^2.*z) );
vrcmax = ((c.*wl./(3*rho*cdo))*z)^0.5;
end
if
ff = 2;
get(pm.r7,'value') == 1
else
ff = get(f,
'userdata');
end
clmax = ff*cos(gama*(pi/180));
vmin = (((c.*wl)-(wl.*(sqrt((c.^2)-(4*cdo*k)))))/(rho*cdo)).^0.5;
vstall = sqrt((2*wl)./(rho*clmax));
%% Gliding Performance :
thetagmin = atand(1/ldmax);
vgmin = vldmax;
%rangeg = alt/(1/ldmax);
vv = vgmin*sind(thetagmin);
vvmin = sqrt((2*wl)/(rho*ld3max^2));
rangeg = alt/(1/ldmax);
m1 = {
'Lift Coefficient','Drag Coefficient','Zero-Lift Drag','Drag Due To Lift',...
'Total Drag','(L/D)max','(L^0.5/D)max ','(L^1.5/D)max',...
'Thrust Required','Thrust Available','Power Required','Power Available',...
'Min.Thrust Required','Min.Power Required','Rate of Climb','Max Climb Angle',...
'Max Rate of Climb','Min Glide Angle','Sink Rate','Glide Range';...
cl cd zd dl d ldmax ld2max ld3max tr ta pr pa trmin prmin rc thetamax rcmax thetagmin
...
vv rangeg};
m2 = {
'Max Lift Coefficient','Altitude','Speed Of Sound',...
'Mach Number','Wing Loading','V at (L/D)max','V at (L^.5/D)max',...
'V at (L^1.5/D)max','Max Speed','Min Speed','Stall Speed',...
'Thrust to Weight Ratio','V at Min.Thrust Required',...
'V at Min.Power Required','Rate of Climb at Max.Climb.Angle!!',...
'V at Max Climb Angle','V at Max Rate of Climb','V at Min Glide Angle','Min Sink Rate';...
clmax alt speed mach wl vldmax vld2max vld3max vmax vmin vstall ta/w vtrmin vprmin
...
rcmaxtheta vthetamax vrcmax vgmin vvmin};
end
%%
% Quick End
function
var = 1;
out (varargin) if nargin == 1else var = cell2mat(varargin(3));end
switch varcase 1 % Output Results
cla
reset
axis
off
text(.1,1,
text(.1,.95-(i/20)+.04,m1(1,i))
text(.225,.95-(i/20)+.04,m1(2,i))
text(.55,.95-(i/20)+.04,m2(1,i))
text(.75,.95-(i/20)+.04,m2(2,i))
'Static Performance Results : ','fontsize',14)for i = 1:19end
text(.1,.95-1+.04,m1(1,20))
text(.225,.95-1+.04,m1(2,20))
c1 = [convforce([m1{2,3:5} m1{2,9:10}],
'lbf','N') [m1{2,11:12}]*0.746 ...
convforce([m1{2,13}],
c2 = convvel([m1{2,15:2:19}],
c3 = [m1{2,16:2:19}].*pi/180;
convf = [c1 c2(1) c3(1) c2(2) c3(2) c2(3:end) convlength(m1{2,20},
m6 = {
'lbf','N') [m1{2,14}]*0.746] ;'ft/s','m/s');'ft','km')];'lb','lb','lb','lb','lb','hp','hp','lb','hp','ft/s','Degree','ft/s',...
'degree','ft/s','ft';'N','N','N','N','N','KWatt','KWatt','N','KWatt',...
text(.28,.85-(i/20)+.04,m6{1,i})
text(.43,.85-(i/20)+.04,m6{2,i})
text(.35,.85-(i/20)+.04,num2str(convf(i)))
'm/s','radian','m/s','radian','m/s','km'};for i = 1:3end
text(.28,.7-(i/20)+.04,m6{1,i})
text(.43,.7-(i/20)+.04,m6{2,i})
text(.35,.7-(i/20)+.04,num2str(convf(i)))
for i = 4:15end
c3 = convvel([m2{2,3} m2{2,6:11} m2{2,13:end}],
cov = [convlength(alt,
m7 = {
'ft/s','m/s');'ft','m') c3(1) m2{2,5}*4.882428 c3(2:end)];'ft','ft/s','lb/ft^2','ft/s','ft/s','ft/s','ft/s','ft/s','ft/s','ft/s','ft/s',...
'ft/s','ft/s','ft/s','ft/s','ft/s';...
'm','m/s','kg/m^2','m/s','m/s','m/s','m/s','m/s','m/s','m/s','m/s','m/s',...
text(.82,.9-(i/20)+.04,m7{1,i})
text(.95,.9-(i/20)+.04,m7{2,i})
text(.88,.9-(i/20)+.04,num2str(cov(i)))
'm/s','m/s','m/s','m/s',};for i = 1:2end
text(.82,.85-(i/20)+.04,m7{1,i})
text(.95,.85-(i/20)+.04,m7{2,i})
text(.88,.85-(i/20)+.04,num2str(cov(i)))
for i = 3:9end
text(.82,.8-(ii/20)+.04,m7{1,ii})
text(.95,.8-(ii/20)+.04,m7{2,ii})
text(.88,.8-(ii/20)+.04,num2str(cov(ii)))
for ii = 10:16end
text(.55,-.01,
'Reference : Aircraft Performance and Design - John D.Anderson - 1999')case 2 % Drag Components
cla
plot(v,n1{2,5},
legend(
set(get(gca,
set(get(gca,
set(get(gca,
axis
reset 'k',v,n1{2,3},'b-',v,n1{2,4},'g-',v,m1{2,13},'k:',m2{2,13},v,'r^')'Total Drag','Zero-Lift Drag','Drag due to Lift','Minimum Thrust Required' )'title'),'string','Total Drag or Thrust Required (lb)','fontsize',14) 'xlabel'),'string','Velocity (ft/sec)','fontsize',14)'ylabel'),'string','Drag (lb)','fontsize',14)tight
case 3 % Lift-Drag Ratios
cla
e = n1{2,1}./n1{2,2};
ff = (n1{2,1}.^0.5)./n1{2,2};
g = (n1{2,1}.^1.5)./n1{2,2};
plot(v,e,
text(m2{2,6},n1{2,6},[
text(m2{2,6},n1{2,6}*.9,[
text(m2{2,7},n1{2,7},[
text(m2{2,7},n1{2,7}*.9,[
text(m2{2,8},n1{2,8},[
text(m2{2,8},n1{2,8}*.9,[
legend(
set(get(gca,
set(get(gca,
set(get(gca,
axis
reset 'c-',v,n1{2,6},v,ff,'b-',v,n1{2,7},v,g,'g-',v,n1{2,8})'Max L/D =',num2str(n1{2,6})])'V at Max (L/D) (ft/sec)= ',num2str(m2{2,6})])'Max (L^0.5/D) = ',num2str(n1{2,7})])'V at Max (L^0.5/D) (ft/sec)= ',num2str(m2{2,7})])'Max (L^1.5/D) = ',num2str(n1{2,8})])'V at Max (L^1.5/D) (ft/sec)= ',num2str(m2{2,8})])'L/D','L^0.5/D','L^1.5/D')'title'),'string','Lift To Drag Ratio','fontsize',14) 'xlabel'),'string','Velocity (ft/sec)','fontsize',14)'ylabel'),'string','Lift / Drag ','fontsize',14)tight
case 4 % Thrust Curve
plot(v,n1{2,9},
text(m2{2,13},m1{2,13},[
text(m2{2,9},m1{2,10},[
text(m2{2,10},m1{2,10},[
text(m2{2,11},m1{2,10}*.9,[
set(get(gca,
set(get(gca,
set(get(gca,
legend(
yy = ylim;
axis([xlim 0 yy(2)])
'k-',v,n1{2,10},'b:',m2{2,13},n1{2,13},'g*','markersize',7)'V at Min Thrust Required = ',num2str(m2{2,13})])'V Max =',num2str(m2{2,9})])'V Min =',num2str(m2{2,10})])'V Stall =',num2str(m2{2,11})])'title'),'string','Thrust Curve','fontsize',14) 'xlabel'),'string','Velocity (ft/sec)','fontsize',14)'ylabel'),'string','Thrust (lb)','fontsize',14)'Thrust Required','Thrust Available')case 5 % Power Curve
plot(v,n1{2,14},
set(get(gca,
set(get(gca,
set(get(gca,
legend(
axis
'k-',v,n1{2,12},'b-.') 'title'),'string','Power (Horsepower)','fontsize',14) 'xlabel'),'string','Velocity (ft/sec)','fontsize',14)'ylabel'),'string','Horse Power','fontsize',14) 'Power Required','Power Available') tight
case 6 % Rate Of Climb
plot(v,n1{2,15},v,n1{2,17},
'g:',m2{2,17},n1{2,17},'rx',...
m2{2,17},n1{2,17},
legend(
text(m2{2,17}*.9,n1{2,17}*.9,[
set(get(gca,
set(get(gca,
set(get(gca,
grid
'ro','markersize',7)'Rate of Climb','Max Rate of Climb')'V at Max Rate of Climb (ft/sec)=',num2str(m2{2,17})])'title'),'string','Rate of Climb','fontsize',14) 'xlabel'),'string','Velocity (ft/sec)','fontsize',14)'ylabel'),'string','Rate of Climb (ft/sec)','fontsize',14) on
case 7 % Drag Polar
plot(n1{2,2},n1{2,1},
text(m1{2,2},m1{2,1}*1.3,[
text(m1{2,2},m1{2,1}*.8,[
set(get(gca,
set(get(gca,
set(get(gca,
grid
'b-')'At CL = ',num2str(m1{2,1})])' CD = ',num2str(m1{2,2})])'title'),'string','Drag Polar','fontsize',14) 'xlabel'),'string','CD','fontsize',14)'ylabel'),'string','CL','fontsize',14,'rotation',0)on
end % Switch End
end
%%
% Out End
end
%%
% Perform End
function
save_toolbar (src,evt,o) %#ok
try uisave('o','.mat')catch
end
end
%%
function
load_toolbar (src,evt) %#ok
[filename , pathname] = uigetfile(
kkk = load([pathname,filename]);
o = kkk.o;
cdo = o(1); k = o(2); w = o(3); s = o(4); gama = o(5);
alt = o(6); v = o(7); et = o(8); fpt = o(9); enp = o(10:end);
set(pm.cd0,
set(pm.cd0slider,
set(pm.k,
set(pm.kslider,
set(pm.w,
set(pm.wslider,
set(pm.s,
set(pm.sslider,
set(pm.sw,
set(pm.swslider,
set(pm.alt,
set(pm.altslider,
set(pm.vel,
set(pm.velslider,
set(pm.r7,
ff = 2;
set(pm.r8,
ff = 2.7;
set(pm.r9,
ff = 2.5;
set(pm.r10,
ff = 3.35;
'*.mat', 'Load Geometry File...');try load([pathname,filename]);'String',{['Zero-Lift Drag (Cdo) = ',num2str(cdo)]})'value',cdo)'String',{['Drag Constant (K) = ',num2str(k)]})'value',k)'String',{['Vehicle Weight = ',num2str(w)]})'value',w)'String',{['Wing Surface Area = ',num2str(s)]})'value',s)'String',{['Leading Edge SweepBack = ',num2str(gama)]})'value',gama)'String',{['Altitude = ',num2str(alt)]})'value',alt)'String',{['Free Stream Velocity = ',num2str(v)]})'value',v)if fpt == 1'value',1)elseif fpt == 2'value',1)elseif fpt == 3'value',1)elseif fpt == 4'value',1)end
set(f,
'userdata',ff)if et == 1 % Turbo Prop
set(pm.r4,
set(pm.avtslider,
'value',1)try set(pm.avt,'visible','off')'visible','off') catch
end
pm.shaft = uicontrol(
'parent',pm.g,'Style','text','String',...
[
'Shaft Horse-Power = ',num2str(enp(1))],'units','normalized',...
pm.shaftslider = uicontrol(
'Position',[0 .25 .9 .05]);'parent',pm.g,'Style','slider',...
'Max',100000,'Min',0,...
'Value',enp(1),'SliderStep',[1/10000 1],...
'units','normalized','Position',[.9 .25 .1 .05],...
pm.eff = uicontrol(
'callback',{@slid,33}); 'parent',pm.g,'Style','text','String',...
[
'Propeller Efficiency = ',num2str(enp(2))],...
'units','normalized',...
pm.effslider = uicontrol(
'Position',[0 .2 .9 .05]);'parent',pm.g,'Style','slider','Max',1,'Min',0,...
'Value',enp(2),'SliderStep',[1/100 1],...
'units','normalized','Position',[.9 .2 .1 .05],...
'callback',{@slid,34});elseif et == 2 || et == 3 % Turbo Fan or Turbo Jet
set(pm.r5,
if et == 2'value',1)end
set(pm.r6,
if et == 3'value',1)end
set(pm.shaftslider,
set(pm.eff,
set(pm.effslider,
try set(pm.shaft,'visible','off')'visible','off')'visible','off')'visible','off')catch
end
pm.avt = uicontrol(
'parent',pm.g,'Style','text','String',...
[
'Total Available Thrust = ',num2str(enp)],...
pm.avtslider = uicontrol(
'units','normalized','Position',[0 .25 .9 .05]);'parent',pm.g,'Style','slider','Max',100000,'Min',0,...
'Value',enp,'SliderStep',[1/10000 1],...
'units','normalized','Position',[.9 .25 .1 .05],...
'callback',{@slid,35});end % Et End
set(pm.r12,
pm.solve = uicontrol(
'value',1)'parent',pm.g,'style','pushbutton','units','normalized',...
'string','Solve','fontsize',14,...
'pos',[0 0 1 .05],'Callback',{@perform},...
'handlevisibility','on');catch
end
end
% Load_Toolbar End
%%
function
slid (src,evt,varargin) %#ok
temps = get (pm.cd0slider,
set(pm.cd0,
temps = get (pm.kslider,
set(pm.k,
temps = get (pm.wslider,
set(pm.w,
temps = get (pm.sslider,
set(pm.s,
temps = get (pm.swslider,
set(pm.sw,
set(pm.sw,
switch cell2mat (varargin)case 26'value');'String',{['Zero-Lift Drag (Cdo) = ',num2str(temps)]})case 27'value');'String',{['Drag Constant (K) = ',num2str(temps)]})case 28'value');'String',{['Vehicle Weight = ',num2str(temps)]})case 29'value');'String',{['Wing Surface Area = ',num2str(temps)]})case 30'value');'String',{['Leading Edge SweepBack = ',num2str(temps)]})'tooltipstring',[num2str(get(pm.swslider,'value')),' Degrees = ',...
num2str(get(pm.swslider,
temps = get (pm.altslider,
set(pm.alt,
temps = get (pm.velslider,
set(pm.vel,
temps = get (pm.shaftslider,
set(pm.shaft,
temps = get (pm.effslider,
set(pm.eff,
temps = get (pm.avtslider,
set(pm.avt,
'value')*pi/180),' Radians'])case 31'value');'String',{['Altitude = ',num2str(temps)]})case 32'value');'String',{['Free Stream Velocity = ',num2str(temps)]})case 33'value');'String',{['Shaft Horse-Power = ',num2str(temps)]}) case 34'value');'String',{['Propeller Efficiency = ',num2str(temps)]})case 35'value');'String',{['Total Available Thrust = ',num2str(temps)]})end % Switch End
end
%%
% Slid End
function
change (src,evt,varargin) %#ok
ss = get(evt.NewValue,
'string');switch cell2mat(varargin)case 1 % Slider Step
switch sscase 'Step Default'
set(pm.cd0slider,
set(pm.kslider,
set(pm.wslider,
set(pm.sslider,
set(pm.swslider,
set(pm.altslider,
set(pm.velslider,
'sliderstep',[1/1000 1])'sliderstep',[1/1000 1]) 'sliderstep',[1/2000 1])'sliderstep',[1/2000 1])'sliderstep',[1/1800 1])if get(pm.r11,'value') == 1'sliderstep',[1/25000 1])'sliderstep',[1/1000 1])else
set(pm.altslider,
set(pm.velslider,
'sliderstep',[1/4000 1])'sliderstep',[1/1000 1])end
try set(pm.shaftslider,'sliderstep',[1/10000 1])catch end
try set(pm.avtslider,'sliderstep',[1/10000 1])catch
end
case 'Step *10'
set(pm.cd0slider,
set(pm.kslider,
set(pm.wslider,
set(pm.sslider,
set(pm.swslider,
set(pm.altslider,
set(pm.velslider,
'sliderstep',[1/100 1])'sliderstep',[1/100 1]) 'sliderstep',[1/200 1])'sliderstep',[1/200 1])'sliderstep',[1/180 1])if get(pm.r11,'value') == 1'sliderstep',[1/2500 1])'sliderstep',[1/100 1])else
set(pm.altslider,
set(pm.velslider,
'sliderstep',[1/400 1])'sliderstep',[1/100 1])end
try set(pm.shaftslider,'sliderstep',[1/1000 1])catch end
try set(pm.avtslider,'sliderstep',[1/1000 1])catch end
case 'Step *100'
set(pm.cd0slider,
set(pm.kslider,
set(pm.wslider,
set(pm.sslider,
set(pm.swslider,
set(pm.altslider,
set(pm.velslider,
'sliderstep',[1/10 1])'sliderstep',[1/10 1]) 'sliderstep',[1/20 1])'sliderstep',[1/20 1])'sliderstep',[1/18 1])if get(pm.r11,'value') == 1'sliderstep',[1/250 1])'sliderstep',[1/10 1])else
set(pm.altslider,
set(pm.velslider,
'sliderstep',[1/40 1])'sliderstep',[1/10 1])end
try set(pm.shaftslider,'sliderstep',[1/100 1])catch end
try set(pm.avtslider,'sliderstep',[1/100 1])catch end
end % Slider Step End
%%
case 2 % Engine Inputs
pm.solve = uicontrol(
'parent',pm.g,'style','pushbutton','units','normalized',...
'string','Solve','fontsize',14,...
'pos',[0 0 1 .05],'Callback',{@perform},...
'handlevisibility','on');switch ss case 'Turbo-Prop'
set(pm.avtslider,
try set(pm.avt,'visible','off')'visible','off')catch
end
pm.shaft = uicontrol(
'parent',pm.g,'Style','text','String',...
[
'Shaft Horse-Power = ',num2str(0)],'units','normalized',...
pm.shaftslider = uicontrol(
'Position',[0 .25 .9 .05]);'parent',pm.g,'Style','slider',...
'Max',100000,'Min',0,...
'Value',0,'SliderStep',[1/10000 1],...
'units','normalized','Position',[.9 .25 .1 .05],...
pm.eff = uicontrol(
'callback',{@slid,33}); 'parent',pm.g,'Style','text','String',...
[
'Propeller Efficiency = ',num2str(0)],...
'units','normalized',...
pm.effslider = uicontrol(
'Position',[0 .2 .9 .05]);'parent',pm.g,'Style','slider','Max',1,'Min',0,...
'Value',0,'SliderStep',[1/100 1],...
'units','normalized','Position',[.9 .2 .1 .05],...
'callback',{@slid,34}); case 'Turbo-Fan'
set(pm.shaftslider,
set(pm.eff,
set(pm.effslider,
try set(pm.shaft,'visible','off')'visible','off')'visible','off')'visible','off')catch
end
pm.avt = uicontrol(
'parent',pm.g,'Style','text','String',...
[
'Total Available Thrust = ',num2str(0)],...
pm.avtslider = uicontrol(
'units','normalized','Position',[0 .25 .9 .05]);'parent',pm.g,'Style','slider','Max',100000,'Min',0,...
'Value',0,'SliderStep',[1/10000 1],...
'units','normalized','Position',[.9 .25 .1 .05],...
'callback',{@slid,35}); case 'Turbo-Jet'
set(pm.shaftslider,
set(pm.eff,
set(pm.effslider,
try set(pm.shaft,'visible','off')'visible','off')'visible','off')'visible','off')catch
end
pm.avt = uicontrol(
'parent',pm.g,'Style','text','String',...
[
'Total Available Thrust = ',num2str(0)],...
pm.avtslider = uicontrol(
'units','normalized','Position',[0 .25 .9 .05]);'parent',pm.g,'Style','slider','Max',100000,'Min',0,...
'Value',0,'SliderStep',[1/10000 1],...
'units','normalized','Position',[.9 .25 .1 .05],...
'callback',{@slid,35});end % Engine Inputs End
%%
case 3 % Flap Inputs
switch ss case 'SingleSlotted'
ff = 2;
case 'Fowler.SingleSlotted'
ff = 2.7;
case 'Fowler.DoubleSlotted'
ff = 2.5;
case 'Fowler.TrippleSlotted'
ff = 3.35;
end % Flap Inputs End
set(f,
'userdata',ff)
%%
case 4 % Tooltip Change
switch sscase 'SI-Units'
set(pm.altslider,
set(pm.alt,
set(pm.alt,
'value',0,'max',25000,'min',0,'sliderstep',[1/2500 1])'string',['Altitude = ',num2str(0)])'tooltipstring',[num2str(get(pm.altslider,'value')),' meter = '...
num2str(convlength(get(pm.altslider,
set(pm.vel,
'value'),'m','ft')),' feet'])'tooltipstring',[num2str(get(pm.velslider,'value')),' m/s = '...
num2str(convvel(get(pm.velslider,
'value'),'m/s','ft/s')),' ft/s'])case 'English-Units'
set(pm.altslider,
set(pm.alt,
set(pm.alt,
'value',0,'max',80000,'min',0,'sliderstep',[1/4000 1])'string',['Altitude = ',num2str(0)])'tooltipstring',[num2str(get(pm.altslider,'value')),' feet = '...
num2str(convlength(get(pm.altslider,
set(pm.vel,
'value'),'ft','m')),' meter'])'tooltipstring',[num2str(get(pm.velslider,'value')),' ft/s = '...
num2str(convvel(get(pm.velslider,
'value'),'ft/s','m/s')),' m/s'])end % Tooltip Change End
end % Main Switch End
end
%%
% Change End
function
cdata = iconRead (filename,guessalpha)
% ICONREAD read an image file and convert it to CData for a HG icon.
%
% CDATA=ICONREAD(FILENAME)
% Read an image file and convert it to CData with automatic transparency
% handling. If the image has transparency data, PNG files sometimes do,
% the transparency data is used. If the image has no CData, the top left
% pixel is treated as the transparent color.
%
% CDATA=ICONREAD(FILENAME, FALSE)
% Same as above but supress the usage of the top left pixel for images
% with no transparency data. This may require the caller to handle the
% transparency explicitly. View the contents of this m-file for an
% example of how to handle transparency.
%
% Example:
%
% icon = fullfile(matlabroot,'toolbox','matlab','icons','matlabicon.gif');
% uitoggletool('CData',iconread(icon));
%
% See also IMREAD.
% Copyright 1984-2007 The MathWorks, Inc.
if
guessalpha = true;
nargin < 2
end
[p,f,ext] = fileparts(filename);
% if this is a mat-file, look for the varible cdata (or something like it)
if
cdata = [];
s = whos(
data = load(filename,s(i).name);
cdata = data.(s(i).name);
isequal(lower(ext),'.mat')'-file',filename);for i=1:length(s)if ~isempty(strfind(lower(s(i).name), 'cdata'))end
end
end
return
[cdata,map,alpha] = imread(filename);
if
isempty(cdata)return;
end
if
cname = class(cdata);
cdata=double(cdata);
cdata = cdata/double(intmax(cname));
isempty(map)if isinteger(cdata)else
cdata=double(cdata);
cdata = cdata/255;
else
end
cdata = ind2rgb(cdata,map);
end
if
isempty(alpha)if ~guessalphareturn;end
% guess the alpha pixel by using the top left pixel in the icon
ap1 = cdata(1,1,1);
ap2 = cdata(1,1,2);
ap3 = cdata(1,1,3);
alpha = cdata(:,:,1) == ap1 & cdata(:,:,2) == ap2 & cdata(:,:,3) == ap3;
alpha = ~alpha;
end
% process alpha data
r = cdata(:,:,1);
r(alpha == 0) = NaN;
g = cdata(:,:,2);
g(alpha == 0) = NaN;
b = cdata(:,:,3);
b(alpha == 0) = NaN;
cdata = cat(3,r,g,b);
end
%%
% IconRead End
function
alt = o;
g = 9.8;
R = 287.1;
gama = 1.4;
rhoo = 1.225;
to = 288.15;
B = .0065;
k(1) = to - B * alt;
k(2) = rhoo * (k(1)/to)^(g/(B*R)-1);
rhoo = .364;
k(1) = 216.66;
k(2) = rhoo *exp(g/(R*k(1))*(11000-alt));
k = altitude (o)if alt >= 0 && alt < 11000elseif alt >= 11000 && alt <= 25000
% else
% error(' Sorry You Are TOO High !! ')
end
k(3)=sqrt(gama*R*k(1));
end
%%
% Altitude End
end
format
close
function
clc
f = figure (