function [ret,x0,str,ts,xts]=derivb00(t,x,u,flag);
%DERIVB00	is the M-file description of the SIMULINK system named DERIVB00.
%	The block-diagram can be displayed by typing: DERIVB00.
%
%	SYS=DERIVB00(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 DERIVB00 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 DERIVB00 with a FLAG of zero:
%	[SIZES]=DERIVB00([],[],[],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',[240,498,1131,963])
     open_system(sys)
end;
set_param(sys,'algorithm',     'RK-45')
set_param(sys,'Start time',    '0.0')
set_param(sys,'Stop time',     '6074')
set_param(sys,'Min step size', '0.1')
set_param(sys,'Max step size', '1')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars',   '')

add_block('built-in/Sum',[sys,'/','Sum'])
set_param([sys,'/','Sum'],...
		'hide name',0,...
		'position',[705,234,745,356])

add_block('built-in/Mux',[sys,'/','Mux'])
set_param([sys,'/','Mux'],...
		'hide name',0,...
		'inputs','3',...
		'position',[600,81,630,209])

add_block('built-in/Gain',[sys,'/','Gain2'])
set_param([sys,'/','Gain2'],...
		'hide name',0,...
		'Gain','0',...
		'position',[480,133,510,157])

add_block('built-in/Gain',[sys,'/','Gain'])
set_param([sys,'/','Gain'],...
		'hide name',0,...
		'Gain','-1.1e-3',...
		'position',[490,178,520,202])

add_block('built-in/Gain',[sys,'/','Gain1'])
set_param([sys,'/','Gain1'],...
		'hide name',0,...
		'Gain','1.1e-3',...
		'position',[480,88,510,112])

add_block('built-in/Demux',[sys,'/','Demux'])
set_param([sys,'/','Demux'],...
		'hide name',0,...
		'outputs','3',...
		'position',[405,79,445,211])

add_block('built-in/MATLAB Fcn',[sys,'/','MATLAB Fcn'])
set_param([sys,'/','MATLAB Fcn'],...
		'hide name',0,...
		'MATLAB Fcn','champmgn(u)',...
		'Output Width','3',...
		'Mask Display','CHAMP MAGNETIQUE\nREPERE ORBITAL',...
		'position',[145,300,320,350])

add_block('built-in/Note',[sys,'/','Temps'])
set_param([sys,'/','Temps'],...
		'hide name',0,...
		'position',[60,350,65,355])

add_block('built-in/Derivative',[sys,'/','Derivative'])
set_param([sys,'/','Derivative'],...
		'hide name',0,...
		'position',[385,315,415,335])

add_block('built-in/Note',[sys,'/',['ESTIMATION DE LA DERIVEE ABSOLUE ',13,'PAR SES COMPOSANTES EN REPERE ORBITAL']])
set_param([sys,'/',['ESTIMATION DE LA DERIVEE ABSOLUE ',13,'PAR SES COMPOSANTES EN REPERE ORBITAL']],...
		'Font Name','Arial',...
		'Font Size',18,...
		'position',[445,5,450,10])

add_block('built-in/To Workspace',[sys,'/','To Workspace'])
set_param([sys,'/','To Workspace'],...
		'hide name',0,...
		'mat-name','dervbabs',...
		'buffer','10000',...
		'position',[785,280,875,310])

add_block('built-in/Clock',[sys,'/','Clock'])
set_param([sys,'/','Clock'],...
		'hide name',0,...
		'position',[70,315,90,335])

add_block('built-in/To Workspace',[sys,'/','To Workspace1'])
set_param([sys,'/','To Workspace1'],...
		'hide name',0,...
		'mat-name','temps',...
		'buffer','10000',...
		'position',[210,215,300,245])
add_line(sys,[95,325;140,325])
add_line(sys,[325,325;380,325])
add_line(sys,[420,325;700,325])
add_line(sys,[360,325;360,145;400,145])
add_line(sys,[450,190;485,190])
add_line(sys,[450,100;475,100])
add_line(sys,[450,145;475,145])
add_line(sys,[515,145;595,145])
add_line(sys,[525,190;555,190;555,105;595,105])
add_line(sys,[515,100;540,100;540,185;595,185])
add_line(sys,[635,145;655,145;655,265;700,265])
add_line(sys,[750,295;780,295])
add_line(sys,[105,325;105,230;205,230])

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
