function[sys,x0]=vymsf(t,x,u,flag)
if flag==0,		%pociatocne pomienky
sys=[2,0,1,1,0,0]; 	%[pocet spoj.stavov, 
							%pocet diskr.stavov, 
							%pocet vystupov, 
							%pocet vstupov, 
							%pocet diskr.nespojitosti, 
							%prepinac, zvycajne 0]
x0(1)=313;
x0(2)=328;

elseif abs(flag)==1,	%riesenie dcr
%q=1;
ro=900;cp=3.84;v1=5;v2=5;
f1=16;f2=16;alfa1=72;alfa2=72;
thetav=293;thetap1=373;thetap2=373;
%m1=q*ro*cp+f1*alfa1;
%m2=q*ro*cp+f2*alfa2;
%t1=v1*ro*cp/m1;t2=v2*ro*cp/m2;
%z1=f1*alfa1/m1;z2=q*ro*cp/m1;
%z3=f2*alfa2/m2;z4=q*ro*cp/m2;
q=u(1);
sys(1)=q/v1*(thetav-x(1))+f1*alfa1/(v1*ro*cp)*(thetap1-x(1));
sys(2)=q/v2*(x(1)-x(2))+f2*alfa2/(v2*ro*cp)*(thetap2-x(2));
sys=[sys(1);sys(2)];

elseif flag==3,		%volba vystupu
sys=x(2)-273;
else
sys=[];
end

