% Aufrufe: 
%   >> num = calcRoots( [1,0] ) 
%   >> num = calcRoots( [1,0,0] )
%   >> num = calcRoots( [1,0,1] ) 
%   >> num = calcRoots( [1,-1,-2,1] ) 
%
function num = calcRoots( pol ) 

  nSt = roots( pol ); 
  
  nAll = length( nSt );
  num = 0;
  for( n=1:nAll )
     if( isreal( nSt(n) ) )
        num = num + 1;
     end
  end
  
  
  % Zusatz: Zeichnen 
  xMin = min( real(nSt) );
  xMax = max( real(nSt) ); 
  diff = xMax - xMin;
  if( diff < eps )  % nur eine Nullstelle 
     diff = 1;
  end
  x = linspace( xMin-diff/4, xMax+diff/4, 100 );
  y = polyval( pol, x );
  plot( x, y );

end
