function [ret,x0,str,ts,xts]=identi(t,x,u,flag);
%IDENTI	is the M-file description of the SIMULINK system named IDENTI.
%	The block-diagram can be displayed by typing: IDENTI.
%
%	SYS=IDENTI(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 IDENTI to return state derivatives, FLAG=2
%	discrete states, FLAG=3 system outputs and FLAG=4 next sample
%	time. For more information and other options see SFUNC.
%
%	Calling IDENTI with a FLAG of zero:
%	[SIZES]=IDENTI([],[],[],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
%		SIZES(5) number of roots (currently unsupported)
%		SIZES(6) direct feedthrough flag
%		SIZES(7) number of sample times
%
%	For the definition of other parameters in SIZES, see SFUNC.
%	See also, TRIM, LINMOD, LINSIM, EULER, RK23, RK45, ADAMS, GEAR.

% 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',[4,55,628,481])
     open_system(sys)
end;
set_param(sys,'algorithm',     'RK-45')
set_param(sys,'Start time',    '0.0')
set_param(sys,'Stop time',     '500')
set_param(sys,'Min step size', '1')
set_param(sys,'Max step size', '1')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars',   '')

add_block('built-in/Memory',[sys,'/','Memory1'])
set_param([sys,'/','Memory1'],...
		'position',[320,25,360,55])

add_block('built-in/Memory',[sys,'/','Memory'])
set_param([sys,'/','Memory'],...
		'position',[210,25,250,55])

add_block('built-in/Memory',[sys,'/','Memory2'])
set_param([sys,'/','Memory2'],...
		'position',[300,95,340,125])

add_block('built-in/Memory',[sys,'/','Memory3'])
set_param([sys,'/','Memory3'],...
		'position',[385,95,425,125])

add_block('built-in/Mux',[sys,'/','Mux'])
set_param([sys,'/','Mux'],...
		'inputs','6',...
		'position',[510,36,540,69])

add_block('built-in/MATLAB Fcn',[sys,'/','MATLAB Fcn'])
set_param([sys,'/','MATLAB Fcn'],...
		'orientation',2,...
		'MATLAB Fcn','ident',...
		'Output Width','5',...
		'position',[380,208,440,242])

add_block('built-in/Demux',[sys,'/','Demux'])
set_param([sys,'/','Demux'],...
		'orientation',2,...
		'outputs','5',...
		'position',[305,204,355,246])


%     Subsystem  'b1'.

new_system([sys,'/','b1'])
set_param([sys,'/','b1'],'Location',[0,59,274,252])

add_block('built-in/Inport',[sys,'/','b1/x'])
set_param([sys,'/','b1/x'],...
		'position',[65,55,85,75])

add_block('built-in/S-Function',[sys,'/',['b1/S-function',13,'M-file which plots',13,'lines',13,'']])
set_param([sys,'/',['b1/S-function',13,'M-file which plots',13,'lines',13,'']],...
		'function name','sfuny',...
		'parameters','ax, color,dt',...
		'position',[130,55,180,75])
add_line([sys,'/','b1'],[90,65;125,65])
set_param([sys,'/','b1'],...
		'Mask Display','plot(0,0,100,100,[90,10,10,10,90,90,10],[65,65,90,40,40,90,90],[90,78,69,54,40,31,25,10],[77,60,48,46,56,75,81,84])',...
		'Mask Type','Graph scope.')
set_param([sys,'/','b1'],...
		'Mask Dialogue','Graph scope using MATLAB graph window.\nEnter plotting ranges and line type.|Time range:|y-min:|y-max:|Line type (rgbw-:*). Seperate each plot by ''/'':')
set_param([sys,'/','b1'],...
		'Mask Translate','color = @4; ax = [0, @1, @2, @3]; dt = -1;')
set_param([sys,'/','b1'],...
		'Mask Help','This block plots to the MATLAB graph window and can be used as an improved version of the Scope block. Look at the m-file sfuny.m to see how it works. This block can take scalar or vector input signal.')
set_param([sys,'/','b1'],...
		'Mask Entries','500\/-1\/1\/''y-/g--/c-./w:/m*/ro/b+''\/')


%     Finished composite block 'b1'.

set_param([sys,'/','b1'],...
		'orientation',2,...
		'position',[150,281,180,319])


%     Subsystem  'b2'.

new_system([sys,'/','b2'])
set_param([sys,'/','b2'],'Location',[0,59,274,252])

add_block('built-in/Inport',[sys,'/','b2/x'])
set_param([sys,'/','b2/x'],...
		'position',[65,55,85,75])

add_block('built-in/S-Function',[sys,'/',['b2/S-function',13,'M-file which plots',13,'lines',13,'']])
set_param([sys,'/',['b2/S-function',13,'M-file which plots',13,'lines',13,'']],...
		'function name','sfuny',...
		'parameters','ax, color,dt',...
		'position',[130,55,180,75])
add_line([sys,'/','b2'],[90,65;125,65])
set_param([sys,'/','b2'],...
		'Mask Display','plot(0,0,100,100,[90,10,10,10,90,90,10],[65,65,90,40,40,90,90],[90,78,69,54,40,31,25,10],[77,60,48,46,56,75,81,84])',...
		'Mask Type','Graph scope.')
set_param([sys,'/','b2'],...
		'Mask Dialogue','Graph scope using MATLAB graph window.\nEnter plotting ranges and line type.|Time range:|y-min:|y-max:|Line type (rgbw-:*). Seperate each plot by ''/'':')
set_param([sys,'/','b2'],...
		'Mask Translate','color = @4; ax = [0, @1, @2, @3]; dt = -1;')
set_param([sys,'/','b2'],...
		'Mask Help','This block plots to the MATLAB graph window and can be used as an improved version of the Scope block. Look at the m-file sfuny.m to see how it works. This block can take scalar or vector input signal.')
set_param([sys,'/','b2'],...
		'Mask Entries','500\/-1\/1\/''y-/g--/c-./w:/m*/ro/b+''\/')


%     Finished composite block 'b2'.

set_param([sys,'/','b2'],...
		'orientation',2,...
		'position',[150,331,180,369])


%     Subsystem  'a2'.

new_system([sys,'/','a2'])
set_param([sys,'/','a2'],'Location',[0,59,274,252])

add_block('built-in/Inport',[sys,'/','a2/x'])
set_param([sys,'/','a2/x'],...
		'position',[65,55,85,75])

add_block('built-in/S-Function',[sys,'/',['a2/S-function',13,'M-file which plots',13,'lines',13,'']])
set_param([sys,'/',['a2/S-function',13,'M-file which plots',13,'lines',13,'']],...
		'function name','sfuny',...
		'parameters','ax, color,dt',...
		'position',[130,55,180,75])
add_line([sys,'/','a2'],[90,65;125,65])
set_param([sys,'/','a2'],...
		'Mask Display','plot(0,0,100,100,[90,10,10,10,90,90,10],[65,65,90,40,40,90,90],[90,78,69,54,40,31,25,10],[77,60,48,46,56,75,81,84])',...
		'Mask Type','Graph scope.')
set_param([sys,'/','a2'],...
		'Mask Dialogue','Graph scope using MATLAB graph window.\nEnter plotting ranges and line type.|Time range:|y-min:|y-max:|Line type (rgbw-:*). Seperate each plot by ''/'':')
set_param([sys,'/','a2'],...
		'Mask Translate','color = @4; ax = [0, @1, @2, @3]; dt = -1;')
set_param([sys,'/','a2'],...
		'Mask Help','This block plots to the MATLAB graph window and can be used as an improved version of the Scope block. Look at the m-file sfuny.m to see how it works. This block can take scalar or vector input signal.')
set_param([sys,'/','a2'],...
		'Mask Entries','500\/-1\/1\/''y-/g--/c-./w:/m*/ro/b+''\/')


%     Finished composite block 'a2'.

set_param([sys,'/','a2'],...
		'orientation',2,...
		'position',[150,226,180,264])


%     Subsystem  'a1'.

new_system([sys,'/','a1'])
set_param([sys,'/','a1'],'Location',[0,59,274,252])

add_block('built-in/Inport',[sys,'/','a1/x'])
set_param([sys,'/','a1/x'],...
		'position',[65,55,85,75])

add_block('built-in/S-Function',[sys,'/',['a1/S-function',13,'M-file which plots',13,'lines',13,'']])
set_param([sys,'/',['a1/S-function',13,'M-file which plots',13,'lines',13,'']],...
		'function name','sfuny',...
		'parameters','ax, color,dt',...
		'position',[130,55,180,75])
add_line([sys,'/','a1'],[90,65;125,65])
set_param([sys,'/','a1'],...
		'Mask Display','plot(0,0,100,100,[90,10,10,10,90,90,10],[65,65,90,40,40,90,90],[90,78,69,54,40,31,25,10],[77,60,48,46,56,75,81,84])',...
		'Mask Type','Graph scope.')
set_param([sys,'/','a1'],...
		'Mask Dialogue','Graph scope using MATLAB graph window.\nEnter plotting ranges and line type.|Time range:|y-min:|y-max:|Line type (rgbw-:*). Seperate each plot by ''/'':')
set_param([sys,'/','a1'],...
		'Mask Translate','color = @4; ax = [0, @1, @2, @3]; dt = -1;')
set_param([sys,'/','a1'],...
		'Mask Help','This block plots to the MATLAB graph window and can be used as an improved version of the Scope block. Look at the m-file sfuny.m to see how it works. This block can take scalar or vector input signal.')
set_param([sys,'/','a1'],...
		'Mask Entries','500\/-1\/1\/''y-/g--/c-./w:/m*/ro/b+''\/')


%     Finished composite block 'a1'.

set_param([sys,'/','a1'],...
		'orientation',2,...
		'position',[150,171,180,209])


%     Subsystem  'Erro'.

new_system([sys,'/','Erro'])
set_param([sys,'/','Erro'],'Location',[0,59,274,252])

add_block('built-in/Inport',[sys,'/','Erro/x'])
set_param([sys,'/','Erro/x'],...
		'position',[65,55,85,75])

add_block('built-in/S-Function',[sys,'/',['Erro/S-function',13,'M-file which plots',13,'lines',13,'']])
set_param([sys,'/',['Erro/S-function',13,'M-file which plots',13,'lines',13,'']],...
		'function name','sfuny',...
		'parameters','ax, color,dt',...
		'position',[130,55,180,75])
add_line([sys,'/','Erro'],[90,65;125,65])
set_param([sys,'/','Erro'],...
		'Mask Display','plot(0,0,100,100,[90,10,10,10,90,90,10],[65,65,90,40,40,90,90],[90,78,69,54,40,31,25,10],[77,60,48,46,56,75,81,84])',...
		'Mask Type','Graph scope.')
set_param([sys,'/','Erro'],...
		'Mask Dialogue','Graph scope using MATLAB graph window.\nEnter plotting ranges and line type.|Time range:|y-min:|y-max:|Line type (rgbw-:*). Seperate each plot by ''/'':')
set_param([sys,'/','Erro'],...
		'Mask Translate','color = @4; ax = [0, @1, @2, @3]; dt = -1;')
set_param([sys,'/','Erro'],...
		'Mask Help','This block plots to the MATLAB graph window and can be used as an improved version of the Scope block. Look at the m-file sfuny.m to see how it works. This block can take scalar or vector input signal.')
set_param([sys,'/','Erro'],...
		'Mask Entries','500\/-.001\/.001\/''y-/g--/c-./w:/m*/ro/b+''\/')


%     Finished composite block 'Erro'.

set_param([sys,'/','Erro'],...
		'orientation',2,...
		'position',[225,356,255,394])


%     Subsystem  'Saída'.

new_system([sys,'/','Saída'])
set_param([sys,'/','Saída'],'Location',[0,59,274,252])

add_block('built-in/Inport',[sys,'/','Saída/x'])
set_param([sys,'/','Saída/x'],...
		'position',[65,55,85,75])

add_block('built-in/S-Function',[sys,'/',['Saída/S-function',13,'M-file which plots',13,'lines',13,'']])
set_param([sys,'/',['Saída/S-function',13,'M-file which plots',13,'lines',13,'']],...
		'function name','sfuny',...
		'parameters','ax, color,dt',...
		'position',[130,55,180,75])
add_line([sys,'/','Saída'],[90,65;125,65])
set_param([sys,'/','Saída'],...
		'Mask Display','plot(0,0,100,100,[90,10,10,10,90,90,10],[65,65,90,40,40,90,90],[90,78,69,54,40,31,25,10],[77,60,48,46,56,75,81,84])',...
		'Mask Type','Graph scope.')
set_param([sys,'/','Saída'],...
		'Mask Dialogue','Graph scope using MATLAB graph window.\nEnter plotting ranges and line type.|Time range:|y-min:|y-max:|Line type (rgbw-:*). Seperate each plot by ''/'':')
set_param([sys,'/','Saída'],...
		'Mask Translate','color = @4; ax = [0, @1, @2, @3]; dt = -1;')
set_param([sys,'/','Saída'],...
		'Mask Help','This block plots to the MATLAB graph window and can be used as an improved version of the Scope block. Look at the m-file sfuny.m to see how it works. This block can take scalar or vector input signal.')
set_param([sys,'/','Saída'],...
		'Mask Entries','500\/-1\/2\/''y-/g--/c-./w:/m*/ro/b+''\/')


%     Finished composite block 'Saída'.

set_param([sys,'/','Saída'],...
		'position',[555,126,585,164])

add_block('built-in/Discrete Transfer Fcn',[sys,'/',['Discrete',13,'Transfer Fcn']])
set_param([sys,'/',['Discrete',13,'Transfer Fcn']],...
		'Numerator','[.5 .5]',...
		'Denominator','[1 .5 .5]',...
		'position',[185,84,265,136])

add_block('built-in/Sum',[sys,'/','Sum'])
set_param([sys,'/','Sum'],...
		'position',[110,100,130,120])

add_block('built-in/Signal Generator',[sys,'/',['Signal',13,'Generator']])
set_param([sys,'/',['Signal',13,'Generator']],...
		'Peak','0.500000',...
		'Peak Range','3.000000',...
		'Freq','0.062800',...
		'Freq Range','20.000000',...
		'Wave','Sqr',...
		'Units','Rads',...
		'position',[5,108,50,142])

add_block('built-in/Signal Generator',[sys,'/',['Signal',13,'Generator1']])
set_param([sys,'/',['Signal',13,'Generator1']],...
		'Peak','0.500000',...
		'Peak Range','5.000000',...
		'Freq','0.030000',...
		'Freq Range','5.000000',...
		'Wave','Rnd',...
		'Units','Rads',...
		'position',[10,53,55,87])
add_line(sys,[255,40;315,40])
add_line(sys,[270,110;295,110])
add_line(sys,[345,110;380,110])
add_line(sys,[365,40;505,40])
add_line(sys,[295,40;295,70;370,70;370,45;505,45])
add_line(sys,[430,110;430,55;505,55])
add_line(sys,[355,110;355,140;455,140;455,60;505,60])
add_line(sys,[270,110;270,150;475,150;475,65;505,65])
add_line(sys,[545,55;615,55;615,225;445,225])
add_line(sys,[375,225;360,225])
add_line(sys,[300,205;255,205;255,190;185,190])
add_line(sys,[300,215;245,215;245,245;185,245])
add_line(sys,[300,225;250,225;250,300;185,300])
add_line(sys,[300,235;255,235;255,350;185,350])
add_line(sys,[300,245;295,245;295,375;260,375])
add_line(sys,[475,145;550,145])
add_line(sys,[135,110;170,110;170,40;205,40])
add_line(sys,[170,80;405,80;405,50;505,50])
add_line(sys,[170,110;180,110])
add_line(sys,[55,125;60,125;60,115;105,115])
add_line(sys,[60,70;70,70;70,105;105,105])

drawnow

% 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,ts,xts]=',sys,'(t,x,u,flag);'])
		else
			eval(['ret =', sys,'(t,x,u,flag);'])
		end
	else
		[ret,x0,str,ts,xts] = feval(sys);
	end
else
	drawnow % Flash up the model and execute load callback
end
