changeset 2530:d189e9fc4d4a octave-forge

Errors fixed.
author sis-sou
date Sat, 30 Sep 2006 08:32:54 +0000
parents 24590b4534d7
children 059ab40718c7
files main/specfun/inst/dirac.m main/specfun/inst/heaviside.m
diffstat 2 files changed, 6 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/main/specfun/inst/dirac.m	Sat Sep 30 05:26:28 2006 +0000
+++ b/main/specfun/inst/dirac.m	Sat Sep 30 08:32:54 2006 +0000
@@ -22,10 +22,6 @@
 		if (nargin != 1)
 			usage ("dirac(x)");
 	   endif
-		
-		if(x == 0)
-			y = Inf;
-		else
-			y = 0;
-		endif
+		y = double(x == 0.);
+		y(x == 0) = Inf;
 endfunction;
\ No newline at end of file
--- a/main/specfun/inst/heaviside.m	Sat Sep 30 05:26:28 2006 +0000
+++ b/main/specfun/inst/heaviside.m	Sat Sep 30 08:32:54 2006 +0000
@@ -22,14 +22,8 @@
 		if (nargin != 1)
 			usage ("heaviside(x)");
 	   endif
-		
-		if(x == 0)
-			y = NaN;
-		else
-			if(x < 0)
-				y = 0;
-			else
-				y = 1;
-			endif
-		endif
+		y = x;
+      y(x>0) = 1.;
+      y(x<0) = 0.;
+      y(x==0) = NaN;
 endfunction;
\ No newline at end of file