function [ret,x0,str]=f14o(t,x,u,flag);
%F14O	is the M-file description of the SIMULINK system named F14O.
%	F14O has a total of 0 states, 13 discrete states, 4 outputs and 3 inputs.
%	The block-diagram can be displayed by typing: F14O.
%
%	SYS=F14O(T,X,U,FLAG) returns depending on FLAG certain
%	system values given time point, T, current state vector, X,
%	and input vector, U.
%	FLAG is used to indicate the type of output to be returned in SYS.
%
%	Setting FLAG=1 causes F14O to return state derivitives, FLAG=2
%	discrete states, FLAG=3 system outputs and FLAG=4 next sample
%	time. For more information and other options see SFUNC.
%
%	Calling F14O with a FLAG of zero:
%	[SIZES]=F14O([],[],[],0),  returns a vector, SIZES, which
%	contains the sizes of the state vector and other parameters.
%		SIZES(1) number of states
%		SIZES(2) number of discrete states
%		SIZES(3) number of outputs
%		SIZES(4) number of inputs.
%	For the definition of other parameters in SIZES, see SFUNC.
%	See also, TRIM, LINMOD, LINSIM, EULER, RK23, RK45, ADAMS, GEAR.

%	Copyright (c) 1990-94 by The MathWorks, Inc.

% Note: This M-file is only used for saving graphical information;
%       after the model is loaded into memory an internal model
%       representation is used.

% the system will take on the name of this mfile: 
sys = mfilename;
new_system(sys)
simver(1.3)
if(0 == (nargin + nargout))
     set_param(sys,'Location',[31,66,679,554])
     open_system(sys)
end;
set_param(sys,'algorithm',		'Linear')
set_param(sys,'Start time',	'0.0')
set_param(sys,'Stop time',		'2')
set_param(sys,'Min step size',	'1e-8')
set_param(sys,'Max step size',	'.01')
set_param(sys,'Relative error','1e-4')
set_param(sys,'Return vars',	'')

add_block('built-in/To Workspace',[sys,'/','To Workspace2'])
set_param([sys,'/','To Workspace2'],...
		'Font Number',3,...
		'mat-name','t',...
		'position',[370,42,415,68])

add_block('built-in/Outport',[sys,'/',['Open Loop',13,'Output']])
set_param([sys,'/',['Open Loop',13,'Output']],...
		'Font Number',3,...
		'Port','3',...
		'position',[230,185,250,205])

add_block('built-in/Outport',[sys,'/','q (rad//sec)'])
set_param([sys,'/','q (rad//sec)'],...
		'Font Number',3,...
		'Port','2',...
		'position',[775,345,795,365])

add_block('built-in/To Workspace',[sys,'/','To Workspace1'])
set_param([sys,'/','To Workspace1'],...
		'Font Number',3,...
		'mat-name','q',...
		'position',[760,288,800,312])

add_block('built-in/To Workspace',[sys,'/','To Workspace'])
set_param([sys,'/','To Workspace'],...
		'Font Number',3,...
		'mat-name','Nzp',...
		'position',[730,47,775,73])

add_block('built-in/Constant',[sys,'/','Constant'])
set_param([sys,'/','Constant'],...
		'orientation',2,...
		'Font Number',3,...
		'Value','0',...
		'position',[405,402,430,428])

add_block('built-in/Inport',[sys,'/',['Open Loop',13,'Input']])
set_param([sys,'/',['Open Loop',13,'Input']],...
		'orientation',2,...
		'Font Number',3,...
		'Port','2',...
		'position',[150,210,170,230])

add_block('built-in/Sum',[sys,'/','Sum2'])
set_param([sys,'/','Sum2'],...
		'orientation',2,...
		'hide name',0,...
		'Font Number',3,...
		'position',[155,385,175,425])

add_block('built-in/Transfer Fcn',[sys,'/',['Alpha-sensor',13,'error model']])
set_param([sys,'/',['Alpha-sensor',13,'error model']],...
		'orientation',2,...
		'Font Number',3,...
		'Numerator','[Sa*sqrt(2*Wa)]',...
		'Denominator','[1 Wa]',...
		'position',[250,389,350,441])

add_block('built-in/Note',[sys,'/','qGust'])
set_param([sys,'/','qGust'],...
		'Font Number',3,...
		'position',[295,280,296,281])

add_block('built-in/Note',[sys,'/','wGust'])
set_param([sys,'/','wGust'],...
		'Font Number',3,...
		'position',[296,255,297,256])

add_block('built-in/Transfer Fcn',[sys,'/',['Actuator',13,'Model']])
set_param([sys,'/',['Actuator',13,'Model']],...
		'Font Number',3,...
		'Denominator','[ Ta, 1]',...
		'position',[285,117,345,163])


%     Subsystem  ['Aircraft Dynamics ',13,'Model'].

new_system([sys,'/',['Aircraft Dynamics ',13,'Model']])
set_param([sys,'/',['Aircraft Dynamics ',13,'Model']],'Location',[50,50,630,485])

add_block('built-in/Note',[sys,'/',['Aircraft Dynamics ',13,'Model/Aircraft Dynamics']])
set_param([sys,'/',['Aircraft Dynamics ',13,'Model/Aircraft Dynamics']],...
		'position',[390,380,391,381])

add_block('built-in/Gain',[sys,'/',['Aircraft Dynamics ',13,'Model/Gain6']])
set_param([sys,'/',['Aircraft Dynamics ',13,'Model/Gain6']],...
		'Font Number',3,...
		'Gain','Md',...
		'position',[135,355,170,395])

add_block('built-in/Gain',[sys,'/',['Aircraft Dynamics ',13,'Model/Gain5']])
set_param([sys,'/',['Aircraft Dynamics ',13,'Model/Gain5']],...
		'Font Number',3,...
		'Gain','Zd',...
		'position',[130,15,165,55])

add_block('built-in/Transfer Fcn',[sys,'/',['Aircraft Dynamics ',13,'Model/Transfer Ftn.2']])
set_param([sys,'/',['Aircraft Dynamics ',13,'Model/Transfer Ftn.2']],...
		'Font Number',3,...
		'Denominator','[1,-Mq]',...
		'position',[365,280,425,330])

add_block('built-in/Sum',[sys,'/',['Aircraft Dynamics ',13,'Model/Sum2']])
set_param([sys,'/',['Aircraft Dynamics ',13,'Model/Sum2']],...
		'Font Number',3,...
		'inputs','+-+',...
		'position',[270,281,290,329])

add_block('built-in/Sum',[sys,'/',['Aircraft Dynamics ',13,'Model/Sum1']])
set_param([sys,'/',['Aircraft Dynamics ',13,'Model/Sum1']],...
		'Font Number',3,...
		'inputs','+-+',...
		'position',[270,106,290,154])

add_block('built-in/Outport',[sys,'/',['Aircraft Dynamics ',13,'Model/Pitch Rate',13,'q (rad//sec)']])
set_param([sys,'/',['Aircraft Dynamics ',13,'Model/Pitch Rate',13,'q (rad//sec)']],...
		'Font Number',3,...
		'Port','2',...
		'position',[515,296,535,314])

add_block('built-in/Outport',[sys,'/',['Aircraft Dynamics ',13,'Model/Vertical Velocity',13,'w (ft//sec)']])
set_param([sys,'/',['Aircraft Dynamics ',13,'Model/Vertical Velocity',13,'w (ft//sec)']],...
		'Font Number',3,...
		'position',[510,121,530,139])

add_block('built-in/Inport',[sys,'/',['Aircraft Dynamics ',13,'Model/Vertical Gust',13,'wGust (ft//sec)']])
set_param([sys,'/',['Aircraft Dynamics ',13,'Model/Vertical Gust',13,'wGust (ft//sec)']],...
		'Font Number',3,...
		'Port','2',...
		'position',[155,118,180,142])

add_block('built-in/Transfer Fcn',[sys,'/',['Aircraft Dynamics ',13,'Model/Transfer Ftn.1 ']])
set_param([sys,'/',['Aircraft Dynamics ',13,'Model/Transfer Ftn.1 ']],...
		'Font Number',3,...
		'Denominator','[1,-Zw]',...
		'position',[365,106,425,154])

add_block('built-in/Gain',[sys,'/',['Aircraft Dynamics ',13,'Model/Gain4']])
set_param([sys,'/',['Aircraft Dynamics ',13,'Model/Gain4']],...
		'orientation',2,...
		'Font Number',3,...
		'Gain','Mw',...
		'position',[305,233,345,277])

add_block('built-in/Gain',[sys,'/',['Aircraft Dynamics ',13,'Model/Gain3']])
set_param([sys,'/',['Aircraft Dynamics ',13,'Model/Gain3']],...
		'orientation',2,...
		'Font Number',3,...
		'Gain','Uo',...
		'position',[305,175,345,215])

add_block('built-in/Inport',[sys,'/',['Aircraft Dynamics ',13,'Model/Elevator',13,'Deflection',13,'d (deg)']])
set_param([sys,'/',['Aircraft Dynamics ',13,'Model/Elevator',13,'Deflection',13,'d (deg)']],...
		'Font Number',3,...
		'position',[35,23,60,47])

add_block('built-in/Inport',[sys,'/',['Aircraft Dynamics ',13,'Model/Rotary Gust',13,'qGust (rad//sec)']])
set_param([sys,'/',['Aircraft Dynamics ',13,'Model/Rotary Gust',13,'qGust (rad//sec)']],...
		'Font Number',3,...
		'Port','3',...
		'position',[160,293,185,317])
add_line([sys,'/',['Aircraft Dynamics ',13,'Model']],[430,130;500,130])
add_line([sys,'/',['Aircraft Dynamics ',13,'Model']],[465,130;465,190;430,255;355,255])
add_line([sys,'/',['Aircraft Dynamics ',13,'Model']],[430,305;505,305])
add_line([sys,'/',['Aircraft Dynamics ',13,'Model']],[465,305;465,255;430,195;355,195])
add_line([sys,'/',['Aircraft Dynamics ',13,'Model']],[175,375;235,375;235,320;260,320])
add_line([sys,'/',['Aircraft Dynamics ',13,'Model']],[170,35;235,35;235,115;260,115])
add_line([sys,'/',['Aircraft Dynamics ',13,'Model']],[300,195;235,195;235,145;260,145])
add_line([sys,'/',['Aircraft Dynamics ',13,'Model']],[190,305;260,305])
add_line([sys,'/',['Aircraft Dynamics ',13,'Model']],[295,305;355,305])
add_line([sys,'/',['Aircraft Dynamics ',13,'Model']],[295,130;355,130])
add_line([sys,'/',['Aircraft Dynamics ',13,'Model']],[300,255;235,255;235,290;260,290])
add_line([sys,'/',['Aircraft Dynamics ',13,'Model']],[185,130;260,130])
add_line([sys,'/',['Aircraft Dynamics ',13,'Model']],[65,35;120,35])
add_line([sys,'/',['Aircraft Dynamics ',13,'Model']],[90,35;90,375;125,375])


%     Finished composite block ['Aircraft Dynamics ',13,'Model'].

set_param([sys,'/',['Aircraft Dynamics ',13,'Model']],...
		'Font Number',3,...
		'position',[530,200,560,250])

add_block('built-in/Note',[sys,'/','q'])
set_param([sys,'/','q'],...
		'Font Number',3,...
		'position',[590,220,591,221])

add_block('built-in/Sum',[sys,'/','Sum'])
set_param([sys,'/','Sum'],...
		'hide name',0,...
		'Font Number',3,...
		'position',[450,280,470,320])

add_block('built-in/Clock',[sys,'/','Clock'])
set_param([sys,'/','Clock'],...
		'Font Number',3,...
		'position',[310,42,335,68])


%     Subsystem  ['Nz pilot ',13,'calculation'].

new_system([sys,'/',['Nz pilot ',13,'calculation']])
set_param([sys,'/',['Nz pilot ',13,'calculation']],'Location',[50,50,587,397])

add_block('built-in/Note',[sys,'/',['Nz pilot ',13,'calculation/Nz = (dq//dt*22.8 + q*Uo - dw//dt)//g']])
set_param([sys,'/',['Nz pilot ',13,'calculation/Nz = (dq//dt*22.8 + q*Uo - dw//dt)//g']],...
		'Font Number',3,...
		'position',[368,295,369,296])

add_block('built-in/Constant',[sys,'/',['Nz pilot ',13,'calculation/Constant']])
set_param([sys,'/',['Nz pilot ',13,'calculation/Constant']],...
		'Font Number',3,...
		'Value','Uo',...
		'position',[25,252,50,278])

add_block('built-in/Gain',[sys,'/',['Nz pilot ',13,'calculation/Gain1']])
set_param([sys,'/',['Nz pilot ',13,'calculation/Gain1']],...
		'Font Number',3,...
		'Gain','22.8',...
		'position',[215,102,265,148])

add_block('built-in/Gain',[sys,'/',['Nz pilot ',13,'calculation/Gain2']])
set_param([sys,'/',['Nz pilot ',13,'calculation/Gain2']],...
		'Font Number',3,...
		'Gain','1/32.2',...
		'position',[390,102,440,148])

add_block('built-in/Inport',[sys,'/',['Nz pilot ',13,'calculation/q']])
set_param([sys,'/',['Nz pilot ',13,'calculation/q']],...
		'Font Number',3,...
		'Port','2',...
		'position',[25,115,45,135])

add_block('built-in/Note',[sys,'/',['Nz pilot ',13,'calculation/Nz pilot calculation']])
set_param([sys,'/',['Nz pilot ',13,'calculation/Nz pilot calculation']],...
		'Font Number',3,...
		'position',[369,270,370,271])

add_block('built-in/Product',[sys,'/',['Nz pilot ',13,'calculation/Product']])
set_param([sys,'/',['Nz pilot ',13,'calculation/Product']],...
		'Font Number',3,...
		'position',[160,242,185,273])

add_block('built-in/Inport',[sys,'/',['Nz pilot ',13,'calculation/w']])
set_param([sys,'/',['Nz pilot ',13,'calculation/w']],...
		'Font Number',3,...
		'position',[25,35,45,55])

add_block('built-in/Derivative',[sys,'/',['Nz pilot ',13,'calculation/Derivative']])
set_param([sys,'/',['Nz pilot ',13,'calculation/Derivative']],...
		'Font Number',3,...
		'position',[125,32,165,58])

add_block('built-in/Sum',[sys,'/',['Nz pilot ',13,'calculation/Sum1']])
set_param([sys,'/',['Nz pilot ',13,'calculation/Sum1']],...
		'Font Number',3,...
		'inputs','-++',...
		'position',[340,95,360,155])

add_block('built-in/Outport',[sys,'/',['Nz pilot ',13,'calculation/Pilot',13,'g force (g)']])
set_param([sys,'/',['Nz pilot ',13,'calculation/Pilot',13,'g force (g)']],...
		'Font Number',3,...
		'position',[470,115,490,135])

add_block('built-in/Derivative',[sys,'/',['Nz pilot ',13,'calculation/Derivative1']])
set_param([sys,'/',['Nz pilot ',13,'calculation/Derivative1']],...
		'Font Number',3,...
		'position',[125,112,165,138])
add_line([sys,'/',['Nz pilot ',13,'calculation']],[50,125;85,125;85,250;150,250])
add_line([sys,'/',['Nz pilot ',13,'calculation']],[85,125;115,125])
add_line([sys,'/',['Nz pilot ',13,'calculation']],[55,265;150,265])
add_line([sys,'/',['Nz pilot ',13,'calculation']],[445,125;460,125])
add_line([sys,'/',['Nz pilot ',13,'calculation']],[365,125;380,125])
add_line([sys,'/',['Nz pilot ',13,'calculation']],[170,45;290,45;290,105;330,105])
add_line([sys,'/',['Nz pilot ',13,'calculation']],[50,45;115,45])
add_line([sys,'/',['Nz pilot ',13,'calculation']],[170,125;205,125])
add_line([sys,'/',['Nz pilot ',13,'calculation']],[270,125;330,125])
add_line([sys,'/',['Nz pilot ',13,'calculation']],[190,260;290,260;290,145;330,145])


%     Finished composite block ['Nz pilot ',13,'calculation'].

set_param([sys,'/',['Nz pilot ',13,'calculation']],...
		'Font Number',3,...
		'position',[655,30,690,85])

add_block('built-in/Gain',[sys,'/','Gain5'])
set_param([sys,'/','Gain5'],...
		'Font Number',3,...
		'Gain','1/Uo',...
		'position',[655,191,705,239])

add_block('built-in/Note',[sys,'/','w'])
set_param([sys,'/','w'],...
		'Font Number',3,...
		'position',[580,195,581,196])

add_block('built-in/Inport',[sys,'/',['alpha',13,'command']])
set_param([sys,'/',['alpha',13,'command']],...
		'orientation',2,...
		'Font Number',3,...
		'position',[140,40,160,60])

add_block('built-in/Outport',[sys,'/','alpha (rad)'])
set_param([sys,'/','alpha (rad)'],...
		'Font Number',3,...
		'position',[755,205,775,225])

add_block('built-in/Sum',[sys,'/','Sum1'])
set_param([sys,'/','Sum1'],...
		'orientation',1,...
		'hide name',0,...
		'Font Number',3,...
		'position',[85,95,120,115])

add_block('built-in/Outport',[sys,'/','Nz Pilot (g)'])
set_param([sys,'/','Nz Pilot (g)'],...
		'Font Number',3,...
		'Port','4',...
		'position',[740,120,760,140])


%     Subsystem  ['Command ',13,'Generator'].

new_system([sys,'/',['Command ',13,'Generator']])
set_param([sys,'/',['Command ',13,'Generator']],'Location',[86,67,533,300])

add_block('built-in/Note',[sys,'/',['Command ',13,'Generator/Second Order Command Generator Model']])
set_param([sys,'/',['Command ',13,'Generator/Second Order Command Generator Model']],...
		'position',[210,180,211,181])

add_block('built-in/Gain',[sys,'/',['Command ',13,'Generator/Gain1']])
set_param([sys,'/',['Command ',13,'Generator/Gain1']],...
		'hide name',0,...
		'Font Number',3,...
		'Gain','0.0349',...
		'position',[65,21,120,79])

add_block('built-in/Sum',[sys,'/',['Command ',13,'Generator/Sum1']])
set_param([sys,'/',['Command ',13,'Generator/Sum1']],...
		'hide name',0,...
		'Font Number',3,...
		'inputs','-+',...
		'position',[295,40,320,75])

add_block('built-in/Transfer Fcn',[sys,'/',['Command ',13,'Generator/Fast Pole']])
set_param([sys,'/',['Command ',13,'Generator/Fast Pole']],...
		'Font Number',3,...
		'Numerator','[426.435]',...
		'Denominator','[ 1 426.435]',...
		'position',[170,96,250,154])

add_block('built-in/Constant',[sys,'/',['Command ',13,'Generator/Constant']])
set_param([sys,'/',['Command ',13,'Generator/Constant']],...
		'Font Number',3,...
		'position',[20,37,45,63])

add_block('built-in/Transfer Fcn',[sys,'/',['Command ',13,'Generator/Slow Pole']])
set_param([sys,'/',['Command ',13,'Generator/Slow Pole']],...
		'Font Number',3,...
		'Numerator','[0.01]',...
		'Denominator','[ 1 0.01]',...
		'position',[170,22,250,78])

add_block('built-in/Outport',[sys,'/',['Command ',13,'Generator/alpha',13,'command']])
set_param([sys,'/',['Command ',13,'Generator/alpha',13,'command']],...
		'Font Number',3,...
		'position',[375,50,395,70])
add_line([sys,'/',['Command ',13,'Generator']],[125,50;160,50])
add_line([sys,'/',['Command ',13,'Generator']],[140,50;140,125;160,125])
add_line([sys,'/',['Command ',13,'Generator']],[50,50;55,50])
add_line([sys,'/',['Command ',13,'Generator']],[255,125;265,125;265,65;285,65])
add_line([sys,'/',['Command ',13,'Generator']],[255,50;285,50])
add_line([sys,'/',['Command ',13,'Generator']],[325,60;365,60])


%     Finished composite block ['Command ',13,'Generator'].

set_param([sys,'/',['Command ',13,'Generator']],...
		'Font Number',3,...
		'position',[35,25,65,75])

add_block('built-in/Gain',[sys,'/','Gain'])
set_param([sys,'/','Gain'],...
		'hide name',0,...
		'Font Number',3,...
		'Gain','Zw',...
		'position',[360,206,400,244])

add_block('built-in/Gain',[sys,'/','Gain2'])
set_param([sys,'/','Gain2'],...
		'hide name',0,...
		'Font Number',3,...
		'Gain','Mw',...
		'position',[360,253,400,297])

add_block('built-in/Gain',[sys,'/','Gain1'])
set_param([sys,'/','Gain1'],...
		'hide name',0,...
		'Font Number',3,...
		'Gain','Mq',...
		'position',[360,305,400,345])


%     Subsystem  ['Dryden Wind ',13,'Gust Models'].

new_system([sys,'/',['Dryden Wind ',13,'Gust Models']])
set_param([sys,'/',['Dryden Wind ',13,'Gust Models']],'Location',[115,54,581,332])

add_block('built-in/Inport',[sys,'/',['Dryden Wind ',13,'Gust Models/Noise',13,'Input']])
set_param([sys,'/',['Dryden Wind ',13,'Gust Models/Noise',13,'Input']],...
		'Font Number',3,...
		'position',[35,37,60,63])

add_block('built-in/Transfer Fcn',[sys,'/',['Dryden Wind ',13,'Gust Models/W-gust model']])
set_param([sys,'/',['Dryden Wind ',13,'Gust Models/W-gust model']],...
		'Font Number',3,...
		'Numerator','Swg/sqrt(a^3)*[sqrt(3)*a,1]',...
		'Denominator','[1 (2/a) 1/a^2]',...
		'position',[110,22,330,78])

add_block('built-in/Outport',[sys,'/',['Dryden Wind ',13,'Gust Models/qGust',13,'(rad//sec)']])
set_param([sys,'/',['Dryden Wind ',13,'Gust Models/qGust',13,'(rad//sec)']],...
		'Font Number',3,...
		'Port','2',...
		'position',[375,172,400,198])

add_block('built-in/Outport',[sys,'/',['Dryden Wind ',13,'Gust Models/wGust',13,'(ft//sec)']])
set_param([sys,'/',['Dryden Wind ',13,'Gust Models/wGust',13,'(ft//sec)']],...
		'Font Number',3,...
		'position',[375,37,400,63])

add_block('built-in/Transfer Fcn',[sys,'/',['Dryden Wind ',13,'Gust Models/Q-gust model']])
set_param([sys,'/',['Dryden Wind ',13,'Gust Models/Q-gust model']],...
		'Font Number',3,...
		'Numerator','pi/(4*b)*[1 0]',...
		'Denominator','[1 pi*Vto/(4*b)]',...
		'position',[150,160,290,210])
add_line([sys,'/',['Dryden Wind ',13,'Gust Models']],[65,50;100,50])
add_line([sys,'/',['Dryden Wind ',13,'Gust Models']],[295,185;365,185])
add_line([sys,'/',['Dryden Wind ',13,'Gust Models']],[335,50;365,50])
add_line([sys,'/',['Dryden Wind ',13,'Gust Models']],[350,50;350,115;115,115;115,185;140,185])


%     Finished composite block ['Dryden Wind ',13,'Gust Models'].

set_param([sys,'/',['Dryden Wind ',13,'Gust Models']],...
		'Font Number',3,...
		'position',[240,262,270,313])

add_block('built-in/Inport',[sys,'/',['Noise',13,'Input']])
set_param([sys,'/',['Noise',13,'Input']],...
		'Font Number',3,...
		'Port','3',...
		'position',[180,280,200,300])


%     Subsystem  'Controller'.

new_system([sys,'/','Controller'])
set_param([sys,'/','Controller'],'Location',[25,56,634,499])

add_block('built-in/Outport',[sys,'/',['Controller/Open Loop',13,'Output']])
set_param([sys,'/',['Controller/Open Loop',13,'Output']],...
		'Font Number',3,...
		'Port','2',...
		'position',[545,217,570,243])

add_block('built-in/Gain',[sys,'/','Controller/Gain'])
set_param([sys,'/','Controller/Gain'],...
		'Font Number',3,...
		'Gain','Kf',...
		'position',[390,15,430,55])

add_block('built-in/Transfer Fcn',[sys,'/',['Controller/Stick',13,'Prefilter']])
set_param([sys,'/',['Controller/Stick',13,'Prefilter']],...
		'Font Number',3,...
		'Denominator','[Ts,1]',...
		'position',[100,80,170,130])

add_block('built-in/Sum',[sys,'/','Controller/Sum'])
set_param([sys,'/','Controller/Sum'],...
		'Font Number',3,...
		'inputs','2',...
		'position',[475,75,500,115])

add_block('built-in/Inport',[sys,'/',['Controller/Stick',13,'Input (in)']])
set_param([sys,'/',['Controller/Stick',13,'Input (in)']],...
		'Font Number',3,...
		'position',[35,92,60,118])

add_block('built-in/Outport',[sys,'/',['Controller/Elevator',13,'Command (deg)']])
set_param([sys,'/',['Controller/Elevator',13,'Command (deg)']],...
		'Font Number',3,...
		'position',[540,82,565,108])

add_block('built-in/Sum',[sys,'/','Controller/Sum2'])
set_param([sys,'/','Controller/Sum2'],...
		'Font Number',3,...
		'inputs','++-',...
		'position',[315,85,340,125])

add_block('built-in/Transfer Fcn',[sys,'/',['Controller/Proportional',13,'plus integral',13,'compensator']])
set_param([sys,'/',['Controller/Proportional',13,'plus integral',13,'compensator']],...
		'Font Number',3,...
		'Numerator','[Ki]',...
		'Denominator','[1,0]',...
		'position',[385,85,440,125])

add_block('built-in/Sum',[sys,'/','Controller/Sum1'])
set_param([sys,'/','Controller/Sum1'],...
		'orientation',3,...
		'Font Number',3,...
		'inputs','2',...
		'position',[257,190,293,210])

add_block('built-in/Gain',[sys,'/','Controller/Gain2'])
set_param([sys,'/','Controller/Gain2'],...
		'Font Number',3,...
		'Gain','Kq',...
		'position',[205,320,245,360])

add_block('built-in/Inport',[sys,'/','Controller/q (rad//sec)'])
set_param([sys,'/','Controller/q (rad//sec)'],...
		'Font Number',3,...
		'Port','3',...
		'position',[30,327,55,353])

add_block('built-in/Transfer Fcn',[sys,'/',['Controller/Pitch Rate',13,'Lead Filter']])
set_param([sys,'/',['Controller/Pitch Rate',13,'Lead Filter']],...
		'Font Number',3,...
		'Numerator','[1,W1]',...
		'Denominator','[1,W2]',...
		'position',[95,315,165,365])

add_block('built-in/Gain',[sys,'/','Controller/Gain3'])
set_param([sys,'/','Controller/Gain3'],...
		'Font Number',3,...
		'Gain','Ka',...
		'position',[205,230,245,270])

add_block('built-in/Inport',[sys,'/','Controller/alpha (rad)'])
set_param([sys,'/','Controller/alpha (rad)'],...
		'Font Number',3,...
		'Port','2',...
		'position',[30,237,55,263])

add_block('built-in/Note',[sys,'/','Controller/Controller'])
set_param([sys,'/','Controller/Controller'],...
		'Font Number',3,...
		'position',[435,300,436,301])

add_block('built-in/Transfer Fcn',[sys,'/',['Controller/Alpha-sensor',13,'Low-pass Filter']])
set_param([sys,'/',['Controller/Alpha-sensor',13,'Low-pass Filter']],...
		'Font Number',3,...
		'Denominator','[Tal,1]',...
		'position',[95,225,170,275])

add_block('built-in/Inport',[sys,'/',['Controller/Open Loop',13,'Input']])
set_param([sys,'/',['Controller/Open Loop',13,'Input']],...
		'Font Number',3,...
		'Port','4',...
		'position',[35,22,60,48])
add_line([sys,'/','Controller'],[275,185;275,160;350,160;350,230;535,230])
add_line([sys,'/','Controller'],[345,105;375,105])
add_line([sys,'/','Controller'],[360,105;360,35;380,35])
add_line([sys,'/','Controller'],[435,35;455,35;455,85;465,85])
add_line([sys,'/','Controller'],[445,105;465,105])
add_line([sys,'/','Controller'],[65,105;90,105])
add_line([sys,'/','Controller'],[505,95;530,95])
add_line([sys,'/','Controller'],[170,340;195,340])
add_line([sys,'/','Controller'],[60,340;85,340])
add_line([sys,'/','Controller'],[175,250;195,250])
add_line([sys,'/','Controller'],[60,250;85,250])
add_line([sys,'/','Controller'],[250,250;265,250;265,220])
add_line([sys,'/','Controller'],[250,340;285,340;285,220])
add_line([sys,'/','Controller'],[175,105;305,105])
add_line([sys,'/','Controller'],[65,35;275,35;275,90;305,90])


%     Finished composite block 'Controller'.

set_param([sys,'/','Controller'],...
		'Font Number',3,...
		'position',[150,125,180,175])
add_line(sys,[340,55;360,55])
add_line(sys,[70,50;95,50;95,85])
add_line(sys,[185,165;215,165;215,195;220,195])
add_line(sys,[565,240;630,240;630,70;645,70])
add_line(sys,[630,240;630,360;105,360;105,155;140,155])
add_line(sys,[630,300;750,300])
add_line(sys,[740,300;740,355;765,355])
add_line(sys,[400,415;360,415])
add_line(sys,[205,290;230,290])
add_line(sys,[145,220;125,220;125,165;140,165])
add_line(sys,[710,215;745,215])
add_line(sys,[720,215;720,375;225,375;225,395;185,395])
add_line(sys,[150,405;85,405;85,145;140,145])
add_line(sys,[245,415;185,415])
add_line(sys,[105,120;105,135;140,135])
add_line(sys,[565,215;645,215])
add_line(sys,[610,215;610,45;645,45])
add_line(sys,[275,275;350,275])
add_line(sys,[320,275;320,225;350,225])
add_line(sys,[475,300;490,300;490,240;520,240])
add_line(sys,[185,140;275,140])
add_line(sys,[405,325;425,325;425,310;440,310])
add_line(sys,[405,275;425,275;425,290;440,290])
add_line(sys,[275,300;320,300;320,325;350,325])
add_line(sys,[405,225;520,225])
add_line(sys,[350,140;510,140;510,210;520,210])
add_line(sys,[135,50;110,50;110,85])
add_line(sys,[695,60;720,60])
add_line(sys,[705,60;705,130;730,130])
% Return any arguments.
if (nargin | nargout)
	% Must use feval here to access system in memory
	if (nargin > 3)
		if (flag == 0)
			eval(['[ret,x0,str]=',sys,'(t,x,u,flag);'])
		else
			eval(['ret =', sys,'(t,x,u,flag);'])
		end
	else
		[ret,x0,str] = feval(sys);
	end
end
