lør, 21 03 2009 kl. 20:29 +0100, skrev Carlo de Falco:
> either this is a bug or it changed in more recent versions of matlab?

Either way, NaN is a really weird return value. How about changing the
function into

function y = heaviside (x, zero_value = 0.5)
  if (nargin < 1)
    print_usage ();
  endif

  y = cast (x > 0, class (x));
  y (x == 0) = zero_value;
endfunction

? Then it'll behave sensible by default, and people that really want
NaN's can still get it.

Søren


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to