function a=elipsa3d(z,xx,hladina,krok,a11,a12,a22,b1,b2,styl);

y1=((b1*xx-a11/2*xx.^2+hladina+(a12*xx-b2).^2/(2*a22)).^0.5-...
   (a12*xx-b2)/(2*a22)^0.5)/(a22/2).^0.5;
y2=(-(b1*xx-a11/2*xx.^2+hladina+(a12*xx-b2).^2/(2*a22)).^0.5-...
   (a12*xx-b2)/(2*a22).^0.5)/(a22/2).^0.5;
zanech=[];
for i=1:size(xx,2);
  if imag(y1(i))==0
     zanech=[zanech, i];
  end;   
end;  
xx=xx(zanech);
y1=y1(zanech);
y2=y2(zanech);
if ~isempty(xx)
 pxx=[xx(1)-krok/2, xx, xx(size(xx,2))+krok/2];
 py1=[(y1(1)+y2(1))/2,y1,(y1(size(y1,2))+y2(size(y2,2)))/2];
 py2=[(y1(1)+y2(1))/2,y2,(y1(size(y1,2))+y2(size(y2,2)))/2];
 figure(1)
 zz=z*ones(size(pxx));
 obj=plot3(pxx,py1,zz,styl);
 set(obj,'LineWidth',1)
 obj=plot3(pxx,py2,zz,styl);
 set(obj,'LineWidth',1)
end;










