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

add_block('built-in/Note',[sys,'/','Products'])
set_param([sys,'/','Products'],...
		'position',[260,295,261,296])

add_block('built-in/Note',[sys,'/','Sums'])
set_param([sys,'/','Sums'],...
		'position',[255,55,256,56])

add_block('built-in/Signal Generator',[sys,'/','U21'])
set_param([sys,'/','U21'],...
		'Peak','1.000000',...
		'Peak Range','1.000000',...
		'Freq','19.086000',...
		'Freq Range','30.000000',...
		'Wave','Sin',...
		'Units','Rads',...
		'position',[25,73,70,107])

add_block('built-in/Signal Generator',[sys,'/','U11'])
set_param([sys,'/','U11'],...
		'Peak','0.491200',...
		'Peak Range','1.000000',...
		'Freq','3.932000',...
		'Freq Range','4.000000',...
		'Wave','Sqr',...
		'Units','Rads',...
		'position',[25,18,70,52])

add_block('built-in/Signal Generator',[sys,'/','U31'])
set_param([sys,'/','U31'],...
		'Peak','100.000000',...
		'Peak Range','100.000000',...
		'Freq','0.470000',...
		'Freq Range','1.000000',...
		'Wave','Sin',...
		'Units','Rads',...
		'position',[25,133,70,167])

add_block('built-in/Mux',[sys,'/','mux1'])
set_param([sys,'/','mux1'],...
		'hide name',0,...
		'inputs','3',...
		'position',[100,75,140,105])

add_block('built-in/Mux',[sys,'/','mux2'])
set_param([sys,'/','mux2'],...
		'hide name',0,...
		'inputs','3',...
		'position',[100,260,140,290])

add_block('built-in/Signal Generator',[sys,'/','U12'])
set_param([sys,'/','U12'],...
		'Peak','2.000000',...
		'Peak Range','2.000000',...
		'Freq','1.040000',...
		'Freq Range','4.000000',...
		'Wave','Sqr',...
		'Units','Rads',...
		'Mask Display','',...
		'position',[25,203,70,237])

add_block('built-in/Signal Generator',[sys,'/','U22'])
set_param([sys,'/','U22'],...
		'Peak','1.000000',...
		'Peak Range','1.000000',...
		'Freq','22.923000',...
		'Freq Range','30.000000',...
		'Wave','Sin',...
		'Units','Rads',...
		'position',[25,258,70,292])

add_block('built-in/Signal Generator',[sys,'/','U32'])
set_param([sys,'/','U32'],...
		'Peak','21.000000',...
		'Peak Range','21.000000',...
		'Freq','1.000000',...
		'Freq Range','1.000000',...
		'Wave','Rnd',...
		'Units','Rads',...
		'position',[25,318,70,352])

add_block('built-in/Product',[sys,'/','f'])
set_param([sys,'/','f'],...
		'hide name',0,...
		'inputs','2',...
		'position',[235,250,250,285])

add_block('built-in/Demux',[sys,'/','demux2'])
set_param([sys,'/','demux2'],...
		'hide name',0,...
		'outputs','3',...
		'position',[275,252,325,288])

add_block('built-in/Scope',[sys,'/','P2'])
set_param([sys,'/','P2'],...
		'Vgain','1.000000',...
		'Hgain','5.000000',...
		'Vmax','2.000000',...
		'Hmax','10.000000',...
		'Window',[100,100,380,320],...
		'position',[365,255,390,285])

add_block('built-in/Scope',[sys,'/','P3'])
set_param([sys,'/','P3'],...
		'Vgain','2000.000000',...
		'Hgain','20.000000',...
		'Vmax','4000.000000',...
		'Hmax','40.000000',...
		'Window',[100,100,380,320],...
		'position',[365,310,390,340])

add_block('built-in/Scope',[sys,'/','S3'])
set_param([sys,'/','S3'],...
		'Vgain','130.000000',...
		'Hgain','20.000000',...
		'Vmax','260.000000',...
		'Hmax','40.000000',...
		'Window',[100,100,380,320],...
		'position',[365,140,390,170])

add_block('built-in/Scope',[sys,'/','S1'])
set_param([sys,'/','S1'],...
		'Vgain','4.000000',...
		'Hgain','20.000000',...
		'Vmax','8.000000',...
		'Hmax','40.000000',...
		'Window',[0,0,280,220],...
		'position',[365,25,390,55])

add_block('built-in/Scope',[sys,'/','S2'])
set_param([sys,'/','S2'],...
		'Vgain','2.000000',...
		'Hgain','5.000000',...
		'Vmax','2.000000',...
		'Hmax','10.000000',...
		'Window',[100,100,380,320],...
		'position',[365,85,390,115])

add_block('built-in/Demux',[sys,'/','demux1'])
set_param([sys,'/','demux1'],...
		'hide name',0,...
		'outputs','3',...
		'position',[275,82,325,118])

add_block('built-in/Scope',[sys,'/','P1'])
set_param([sys,'/','P1'],...
		'Vgain','4.000000',...
		'Hgain','20.000000',...
		'Vmax','8.000000',...
		'Hmax','40.000000',...
		'Window',[0,0,280,220],...
		'position',[365,200,390,230])

add_block('built-in/Sum',[sys,'/','e'])
set_param([sys,'/','e'],...
		'hide name',0,...
		'inputs','++',...
		'position',[230,80,245,120])


%     Subsystem  'More Info'.

new_system([sys,'/','More Info'])
set_param([sys,'/','More Info'],'Location',[85,154,463,375])

add_block('built-in/Note',[sys,'/',['More Info/Use the Signal Generators and Scopes',13,'to observe how the signals are blended and displayed']])
set_param([sys,'/',['More Info/Use the Signal Generators and Scopes',13,'to observe how the signals are blended and displayed']],...
		'position',[174,100,175,101])

add_block('built-in/Note',[sys,'/',['More Info/This demonstration shows how multivariate',13,'lines are not only legal, but can be added and ',13,'multiplied with ease.']])
set_param([sys,'/',['More Info/This demonstration shows how multivariate',13,'lines are not only legal, but can be added and ',13,'multiplied with ease.']],...
		'position',[175,20,176,21])
set_param([sys,'/','More Info'],...
		'Mask Display','?')


%     Finished composite block 'More Info'.

set_param([sys,'/','More Info'],...
		'hide name',0,...
		'Drop Shadow',4,...
		'position',[325,365,352,390])

add_block('built-in/Note',[sys,'/',['Sums and Products of Multiplexed Lines',13,'(Double click on the "?" for more info)']])
set_param([sys,'/',['Sums and Products of Multiplexed Lines',13,'(Double click on the "?" for more info)']],...
		'position',[191,365,192,366])
add_line(sys,[145,90;225,90])
add_line(sys,[195,90;195,260;230,260])
add_line(sys,[145,275;230,275])
add_line(sys,[160,275;160,110;225,110])
add_line(sys,[250,100;270,100])
add_line(sys,[75,90;95,90])
add_line(sys,[75,35;75,80;95,80])
add_line(sys,[75,150;75,100;95,100])
add_line(sys,[75,335;75,285;95,285])
add_line(sys,[75,275;95,275])
add_line(sys,[75,220;75,265;95,265])
add_line(sys,[255,270;270,270])
add_line(sys,[330,260;340,260;340,215;360,215])
add_line(sys,[330,280;340,280;340,325;360,325])
add_line(sys,[330,270;360,270])
add_line(sys,[330,100;360,100])
add_line(sys,[330,110;340,110;340,155;360,155])
add_line(sys,[330,90;340,90;340,40;360,40])
% Return any arguments.
if (nargin | nargout)
	% Must use feval here to access system in memory
	if (nargin > 3)
		if (flag == 0)
			eval(['[ret,x0,xstr]=',sys,'(t,x,u,flag);'])
		else
			eval(['ret =', sys,'(t,x,u,flag);'])
		end
	else
		[ret,x0,str] = feval(sys);
	end
end
