function [ret,x0,str]=sinks(t,x,u,flag);
%SINKS	is the M-file description of the SIMULINK system named SINKS.
%	The block-diagram can be displayed by typing: SINKS.
%
%	SYS=SINKS(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 SINKS 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 SINKS with a FLAG of zero:
%	[SIZES]=SINKS([],[],[],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',[36,68,380,293])
     open_system(sys)
end;
set_param(sys,'algorithm',		'Euler')
set_param(sys,'Start time',	'0.0')
set_param(sys,'Stop time',		'10')
set_param(sys,'Min step size',	'0.01')
set_param(sys,'Max step size',	'.1')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars',	'')

add_block('built-in/Scope',[sys,'/','Scope'])
set_param([sys,'/','Scope'],...
		'Vgain','1.500000',...
		'Hgain','10.100000',...
		'Vmax','1.500000',...
		'Hmax','20.200000',...
		'Window',[390,148,640,290],...
		'position',[250,17,280,53])

add_block('built-in/To Workspace',[sys,'/','To Workspace'])
set_param([sys,'/','To Workspace'],...
		'mat-name','to_workspace',...
		'position',[220,83,310,117])

add_block('built-in/To File',[sys,'/','To File'])
set_param([sys,'/','To File'],...
		'File name','to_file_data.mat',...
		'Matrix name','from_simulink',...
		'position',[215,149,320,191])

add_block('built-in/Signal Generator',[sys,'/','Signal Gen.'])
set_param([sys,'/','Signal Gen.'],...
		'Peak','1.000000',...
		'Peak Range','1.000000',...
		'Freq','2.000000',...
		'Freq Range','2.000000',...
		'Wave','Saw',...
		'Units','Rads',...
		'position',[35,83,80,117])
add_line(sys,[85,100;153,100;153,170;205,170])
add_line(sys,[85,100;153,100;153,35;240,35])
add_line(sys,[85,100;210,100])
% 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
