function [ret,x0,str]=rez(t,x,u,flag);
%REZ	is the M-file description of the SIMULINK system named REZ.
%	The block-diagram can be displayed by typing: REZ.
%
%	SYS=REZ(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 REZ 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 REZ with a FLAG of zero:
%	[SIZES]=REZ([],[],[],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.

% 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.01)
if(0 == (nargin + nargout))
     set_param(sys,'Location',[100,100,600,400])
     open_system(sys)
end;
set_param(sys,'algorithm',		'RK-45')
set_param(sys,'Start time',	'0.0')
set_param(sys,'Stop time',		'999999')
set_param(sys,'Min step size',	'0.0001')
set_param(sys,'Max step size',	'10')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars',	'')

add_block('built-in/Note',[sys,'/',['function rez=atenuare(zl,ze,a)',13,'zint=zeros(1,length(zl));',13,'for i=1:9',13,'if (zl(i)<=600) zint(i)=600*(1-a(i))//(1+a(i));',13,'else zint(i)=600*(1+a(i))//(1-a(i));',13,'end;',13,'end;',13,'']])
set_param([sys,'/',['function rez=atenuare(zl,ze,a)',13,'zint=zeros(1,length(zl));',13,'for i=1:9',13,'if (zl(i)<=600) zint(i)=600*(1-a(i))//(1+a(i));',13,'else zint(i)=600*(1+a(i))//(1-a(i));',13,'end;',13,'end;',13,'']],...
		'position',[45,15,46,16])

% 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
